質問

JQuery UI 1.8.5 Tabsプラグインを使用しています。 CSSクラスを追加するためにタブが崩壊した後、関数を呼び出す必要があります。誰かがどのように知っていますか?

役に立ちましたか?

解決

次のことを確認できます 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 イベント。

他のヒント

はどうですか イベントを表示します これには役に立たない?どちらが隠されているのかわからないからですか?

多分 イベントを選択します あなたが望むものかもしれません。

を使用して 「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
         }
    }
});
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top