
頁籤
|
25
使用 tabsadd 事件
讓我們沿用同一個範例,但是改用
bind()
處理事件。使用這種作法的時候,新建頁籤
時,jQuery UI 會觸發
tabsadd
事件(粗體部份):
<script src = jquery.js></script>
<script src = jqueryui/js/jquery-ui-1.8.16.custom.min.js></script>
<link rel=stylesheet type=text/css
href=jqueryui/css/smoothness/jquery-ui-1.8.16.custom.css />
<div id=tabs>
<ul>
<li><a href=#tab1>Tab 1</a></li>
<li><a href=#tab2>Tab 2</a></li>
<li><a href=#tab3>Tab 3</a></li>
</ul>
<div id=tab1>Contents of first tab</div>
<div id=tab2>Contents of the second tab</div>
<div id=tab3>Contents of the third tab</div>
</div>
<script>
$("#tabs").tabs ({
fx : { opacity : "toggle" }
}).bind ("tabsadd", function (event, tab)
{
$(tab.panel).load ...