jquery选项卡绑定tabsselect或tabsshow未触发

Mic*_*hal 4 jquery jquery-ui event-handling

我有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();
  }
});
Run Code Online (Sandbox Code Playgroud)

Aru*_*hny 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();
  }
});
Run Code Online (Sandbox Code Playgroud)

演示:小提琴