获取激活选项卡的索引 [英] Get Index of Activated Tab

查看:120
本文介绍了获取激活选项卡的索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将代码从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());
    }
});

这篇关于获取激活选项卡的索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆