如何让 jQuery 选项卡正常工作?
我正在使用这个示例:
http://jqueryui.com/demos/tabs/
并尝试让选项卡像在线框上一样工作或至少关闭: http://problemio.com/wireframe.pdf到目前为止
我所拥有的是这个查询:
$(function()
{
$( "#tabs" ).tabs();
...
和这个html:
<div id="tabs">
<ul>
<li><a href="#tabs-1">First Tab</a></li>
<li><a href="#tabs-2">Second Tab</a></li>
<li><a href="#tabs-3">Third Tab</a></li>
</ul>
<div id="tabs-1">
<p>First tab stuff</p>
</div>
<div id="tabs-2">
<p>Second tab stuff</p>
</div>
<div id="tabs-3">
<p>Third tab stuff</p>
</div>
</div>
但由于某种原因,这根本不起作用,只是将表格显示为不执行任何操作的链接。我正在导入这个js:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
我做错了什么?
I am working from this example:
http://jqueryui.com/demos/tabs/
and trying to get the tabs to work like they look on this wireframe or at least close: http://problemio.com/wireframe.pdf
What I have so far is this query:
$(function()
{
$( "#tabs" ).tabs();
...
and this html:
<div id="tabs">
<ul>
<li><a href="#tabs-1">First Tab</a></li>
<li><a href="#tabs-2">Second Tab</a></li>
<li><a href="#tabs-3">Third Tab</a></li>
</ul>
<div id="tabs-1">
<p>First tab stuff</p>
</div>
<div id="tabs-2">
<p>Second tab stuff</p>
</div>
<div id="tabs-3">
<p>Third tab stuff</p>
</div>
</div>
But for some reason this doesn't work at all and just shows the tabls as links that don't do anything. I am importing this js:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我自己已经经历过这个问题。就我而言,我忘记添加 jquery UI 插件的 css 引用。您似乎也没有添加它们。
你能仔细检查一下你是否包含了CSS吗?您应该能够使用 googleapis CDN - 例如:
在这里您将找到可用主题的列表:JQuery-UI 博客 - v1.8.16。他们还提供各种可用 CDN 位置的链接(上面的链接取自那里)。
Already experienced this issue myself. In my case, I'd forgot to add the css references for the jquery UI plugin. You don't seem to be adding them either.
Could you doublecheck if you have included the css? You should be able to use googleapis CDN - for example:
Here you will find the list of available themes: JQuery-UI Blog - v1.8.16. They also provide links to the various available CDN locations (the above link was taken from there).
我认为你可能缺少CSS。尝试包含
http://jqueryui.com/themes/base/jquery.ui。所有.css
I think you may be missing the CSS. Try to include
http://jqueryui.com/themes/base/jquery.ui.all.css