在下面的代码中,没有任何警报被调用?
<head>
<script src='../../Scripts/jquery/jquery.js' type='text/javascript'></script>
<link rel="stylesheet" href="../../content/jquery-tabs/jquery.tabs.css" type="text/css" media="print, projection, screen">
<script src="../../Scripts/jquery-tabs/jquery.history_remote.pack.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-tabs/jquery.tabs.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#tabs").tabs();
});
$(document).ready(function() {
$('#tabs').bind('tabsselect', function(event, ui) {
// Objects available in the function context:
alert(ui.tab); // anchor element of the selected (clicked) tab
alert(ui.panel); // element, that contains the selected/clicked tab contents
alert(ui.index); // zero-based index of the selected (clicked) tab
});
});
</script>
</head>
<body>
<h2>
TestTabs</h2>
<div id="tabs">
<ul>
<li><a href="#fragment-1"><span>1 Info</span></a></li>
<li><a href="#fragment-2"><span>2 Info</span></a></li>
<li><a href="#fragment-3"><span>3 Info</span></a></li>
<li><a href="#fragment-4"><span>4 Info</span></a></li>
</ul>
<div id="fragment-1">
<h2>TestTabs</h2>
</div>
<div id="fragment-2">
<h2>TestTabs</h2>
</div>
<div id="fragment-3">
<h2>TestTabs</h2>
</div>
<div id="fragment-4">
<h2>TestTabs</h2>
</div>
</div>
发布于 2010-01-04 00:45:31
It works for me。
请确保您使用的是当前版本的jQuery UI。
你得到任何脚本错误吗?
发布于 2010-01-04 00:53:24
代码看起来是正确的,这意味着它很可能是以下两种情况之一:
我的猜测是#2,所以你应该仔细检查它是否正常工作。对于kicks,返回到http://jqueryui.com/download页面,单击“取消选择所有组件”,然后单击"Tabs“以仅选择core和tabs。然后选择“无主题”,然后下载。在您的tabs.min.js文件中使用该js文件,然后看看它是否可以工作。
最后要检查的是,确保您使用的jQuery + jQuery UI的版本匹配。对于jQuery 1.3+,请使用jQuery UI 1.7.2。对于jQuery 1.2.6,请使用jQuery UI 1.6
https://stackoverflow.com/questions/1995492
复制相似问题