1

私はjQueryUI1.8.5タブプラグインを使用しており、折りたたみ可能:真の構成です。タブを折りたたんだ後、cssクラスを追加するために関数を呼び出す必要があります。誰かが方法を知っていますか?

4

2 に答える 2

1

ショーイベントはこれではうまくいきませんか?どれが隠されているのかわからないので?

たぶん、selectイベントでさえあなたが望むものかもしれません。

'tabsselect'イベントの使用:

$(".selector").tabs({
    collapsible: true,
    select: function(event, ui)
    {
         var prevSelectedIndex = $(".selector").tabs('option', 'selected');
         var nextSelectedIndex = ui.index;

         if(prevSelectedIndex === -1)
         {
             // It was previously collapsed and the user is now opening
             // tab at index: nextSelectedIndex 
         }
         else if(prevSelectedIndex === nextSelectedIndex )
         {
              // The user has clicked on the currently opened
              // tab and it is collapsing
         }
    }
});
于 2010-11-01T20:25:37.257 に答える
1

ui-tabs-selectedクリックでクラスが存在するかどうかを確認できます。標準のマークアップを使用していると仮定します。

// in your click event
var selected_exists = $('#yourTabBox')
    .children('ul.ui-tabs-nav')
    .children('li.ui-tabs-selected')
    .length;

if (selected_exists) {
    // Nothing is collapsed
} else {
    // collapsed
}

これはselectイベントに最適です。

于 2010-11-01T20:28:01.053 に答える