获取激活选项卡的索引

问题描述:

我正在将代码从jQuery UI 1.8升级到1.10.

I'm upgrading code from jQuery UI 1.8 to 1.10.

在1.8下,选项卡更改时触发的事件是select,我可以通过ui.index访问所选择的选项卡的索引.

Under 1.8, the event triggered when the tab changes was select, and I could access the index of the tab being selected through ui.index.

在1.10下,选项卡更改时触发的事件为activate.但是,我无法在事件参数ui中找到任何内容来告诉我新激活的选项卡的索引.

Under 1.10, the event triggered when the tab changes is activate. However, I cannot find anything in the event parameter ui that tells me the index of the newly activated tab.

如何找到该索引?

您可以使用以下方法 http://jsfiddle.net/9ChL5/1/:

$("#tabs").tabs({
    activate: function (event, ui) {

        console.log(ui.newTab.index());
    }
});