gpt4 book ai didi

jquery tabs 绑定(bind) tabsselect 或 tabsshow 未触发

转载 作者:行者123 更新时间:2023-11-30 23:55:22 30 4
gpt4 key购买 nike

我在使用 jquery 选项卡时遇到问题。如果我绑定(bind)到选项卡的 tabsselect 或 tabsshow 事件,它们不会被触发。

我正在使用最新的 jquery-ui 1.10.3,并且我的 web 应用程序控制台中没有 js 错误。

代码:

$("#tabs").tabs();

$("#tabs").bind('tabsselect', function(event, ui) {
alert(ui.index); // This is never displayed
if (ui.index === 1 && plot1._drawCount === 0) {
plot1.replot();
}
else if (ui.index === 2 && plot2._drawCount === 0) {
plot2.replot();
}
});

最佳答案

事件是activate

$("#tabs").on('tabsactivate', function(event, ui) {
var index = ui.newTab.index();
alert(index); // This is never displayed
if (ui.index === 1 && plot1._drawCount === 0) {
plot1.replot();
}
else if (ui.index === 2 && plot2._drawCount === 0) {
plot2.replot();
}
});

演示:Fiddle

关于jquery tabs 绑定(bind) tabsselect 或 tabsshow 未触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18769208/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com