在以下code所有选项卡最初显示他们正确的文本(家庭,报告,安装,文档,支持)。当任何AJAX标签被点击(主页,文档,支持)上的标签修改文本为载入中...。然而,2个非Ajax选项卡(报告和设置)保持自己的文字。我如何阻止它去载入中...为什么会变成这样的变化?
< HTML>
< HEAD>
<链接HREF =http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css相对=样式类型=文本/ CSS/>
&所述;脚本的src =http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js>&所述; /脚本>
&所述;脚本的src =http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js>&所述; /脚本>
<脚本>
$(文件)。就绪(函数(){
$(#标签)选项卡()。
});
< / SCRIPT>
< /头>
<脚本>
$(文件)。就绪(函数(){
$(#标签)选项卡({ajaxOptions:{缓存:假}})。
}
< / SCRIPT>
< HTML>
< DIV ID =标签>
< DIV ID =菜单>
< UL>
<李>< A HREF =home.php标题=首页><跨度>家< / SPAN>< / A>< /李>
<李>< A HREF =#report_tabs称号=报告><跨度>报告< / SPAN>< / A>< /李>
<李>< A HREF =#setup_tabs称号=设置><跨度>设置< / SPAN>< / A>< /李>
<李>< A HREF =documentation.php称号=文档和GT;<跨度>文件< / SPAN>< / A>< /李>
<李>< A HREF =support.php称号=载体><跨度>支持< / SPAN>< / A>< /李>
< / UL>
< / DIV>
< / DIV>
< / HTML>
解决方案
您可以设置 微调
选项以假
,或一个空字符串,像这样的:
$(#标签)。标签({
ajaxOptions:{缓存:假},
微调:假的
});
您可以看到 如果(o.spinner)
点击这里,无论这些都会失败这个检查,避免了更换(如将其他数据类型,但假
是最清楚的意图IMO)。
In the following code all of the tabs initially display their proper text (Home,Reports,Setup,Documentation,Support). When any of the ajax tabs are clicked (Home, Documentation, Support) the text on the tab changes to "Loading...". However, the 2 non ajax tabs (Reports and Setup) keep their text. How do I keep it from going to "Loading..." Why would this change?
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
$("#tabs").tabs();
});
</script>
</head>
<script>
$(document).ready(function() {
$("#tabs").tabs({ ajaxOptions: {cache: false}});
}
</script>
<html>
<div id="tabs">
<div id="menu">
<ul>
<li><a href="home.php" title=Home><span>Home</span></a></li>
<li><a href="#report_tabs" title=Reports><span>Reports</span></a></li>
<li><a href="#setup_tabs" title=Setup><span>Setup</span></a></li>
<li><a href="documentation.php" title=Documentation><span>Documentation</span></a></li>
<li><a href="support.php" title=Support><span>Support</span></a></li>
</ul>
</div>
</div>
</html>
解决方案
You can set the spinner
option to false
, or an empty string, like this:
$("#tabs").tabs({
ajaxOptions: {cache: false},
spinner: false
});
You can see the if(o.spinner)
check here, either of these will fail this check, avoiding the replacement (as will other data types, but false
is the clearest intention IMO).