0

http://docs.jquery.com/UI/Tabs#demo我发现下面关于在选项卡向导上创建事件的描述。在我看来,两种方式都将回调函数与 create 事件联系起来。但我相信它们的用法一定有一些不同。是否应该在创建选项卡时使用第一种方法,而在构建选项卡后使用第二种方法?

//方法1

Supply a callback function to handle the create event as an init option.
$( ".selector" ).tabs({
   create: function(event, ui) { ... }
});

//方法2

Bind to the create event by type: tabscreate.
$( ".selector" ).bind( "tabscreate", function(event, ui) {
  ...
});
4

1 回答 1

0

不,它们是等价的。它们都使您能够在创建选项卡实例时运行代码。我想说第一种方法比第二种方法更常见一些。尽管 jQuery UI 团队中的某个人需要更新对已弃用.bind()函数的引用。

于 2012-08-20T17:20:52.070 回答