Javascript jquery ui选项卡选择不';在1.10.3中似乎不起作用
以下程序适用于jQueryUI的早期版本,但不适用于最新版本 select属性不调用Javascript jquery ui选项卡选择不';在1.10.3中似乎不起作用,javascript,jquery,jquery-ui,Javascript,Jquery,Jquery Ui,以下程序适用于jQueryUI的早期版本,但不适用于最新版本 select属性不调用handleSelect变量中的函数。看下面的小提琴: 这是我的jQueryUI1.10.3代码 <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Tabs</title> <link rel="stylesheet" href="css/smoo
handleSelect
变量中的函数。看下面的小提琴:
这是我的jQueryUI1.10.3代码
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Tabs</title>
<link rel="stylesheet" href="css/smoothness/jquery-ui-1.10.2.custom.css">
<link rel="stylesheet" href="css/tabSelect.css">
</head>
<body>
<div id="myTabs">
<ul>
<li><a href="#a">Tab 1</a></li>
<li><a href="#b">Tab 2</a></li>
</ul>
<div id="a">This is the content panel linked to the first tab, it is shown by default.</div>
<div id="b">This is the content panel linked to the second tab, it is shown when its tab is clicked.</div>
</div>
<script type="text/javascript" src="development-bundle/jquery-1.9.1.js"></script>
<script type="text/javascript" src="development-bundle/ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="development-bundle/ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="development-bundle/ui/jquery.ui.tabs.js"></script>
<script type="text/javascript" src="development-bundle/ui/jquery.ui.effect.js"></script>
<script type="text/javascript" src="development-bundle/ui/jquery.ui.effect-blind.js"></script>
<script type="text/javascript">
(function($) {
var handleSelect = function(e, tab) {
$("<p></p>", {
text: "Tab at index " + tab.index + " selected",
"class": "status-message ui-corner-all"
}).appendTo(".ui-tabs-nav", "#myTabs").fadeOut(5000, function(){
$(this).remove();
});
},
tabOpts = {
select : handleSelect
};
$("#myTabs").tabs({ select: handleSelect});
})(jQuery);
</script>
</body>
</html>
标签
这是链接到第一个选项卡的内容面板,默认情况下显示。
这是链接到第二个选项卡的内容面板,单击其选项卡时显示。
(函数($){
var handleSelect=函数(e,选项卡){
$(“”{
文本:“索引处的选项卡”+Tab.index+“选定”,
“类”:“状态消息ui全部”
}).appendTo(“.ui选项卡导航”,“#myTabs”).fadeOut(5000,函数(){
$(this.remove();
});
},
禁忌={
选择:handleSelect
};
$(“#myTabs”).tabs({select:handleSelect});
})(jQuery);
请参见jQuery UI 1.10的
删除选择事件;在激活之前使用
(#7154)已删除select
事件,以支持beforeActivate
。有关详细信息
这是一个
取代
$("#myTabs").tabs({ select: handleSelect});
与
编辑
刚刚注意到你的索引也不能使用1.10。更新了我的小提琴!
看
var handleSelect=函数(e,选项卡){
$(“”{
//这是新的
文本:“索引处的选项卡”+Tab.newTab.index()+“选定”,
“类”:“状态消息ui全部”
}).appendTo(“.ui选项卡导航”,“#myTabs”).fadeOut(5000,函数(){
$(this.remove();
});
}
不客气!升级前查看升级指南始终是一个好主意。:)谢谢你接受我的回答
$("#myTabs").tabs({ beforeActivate: handleSelect});
var handleSelect = function(e, tab) {
$("<p></p>", {
//this is new
text: "Tab at index " + tab.newTab.index() + " selected",
"class": "status-message ui-corner-all"
}).appendTo(".ui-tabs-nav", "#myTabs").fadeOut(5000, function(){
$(this).remove();
});
}