4

我有 jquery 选项卡的问题。如果我绑定到选项卡的 tabsselect 或 tabsshow 事件,它们不会被触发。

我正在使用最新的 jquery-ui 1.10.3,并且我的 webapp 控制台中没有 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();
  }
});
4

1 回答 1

10

活动已激活

$("#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();
  }
});

演示:小提琴

于 2013-09-12T16:05:46.577 回答