你可以在单独的包含 div 中拥有 jQuery UI 选项卡吗
我希望将选项卡的链接列表放在网站的顶部,并更改底部的内容。这些将位于两个单独的 div 中。这可能吗?我找不到任何文档表明可以,只是它们必须位于同一个 div 中。我不想求助于一堆绝对定位的元素。谢谢
I'd like to have my tab's link list in the top part of my site and have it change content in the bottom. These would be in two separate div's. Is this possible? I can't find any documentation out there that says it can, only that they have to be in the same div. I don't want to have to resort to a bunch of absolute positioned elements. thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用以下代码修改 JQuery-UI 小部件,以将选项卡和内容窗格分离:
在 tabs.ui 小部件中, _getPanelForTab 方法开始搜索选项卡 div 内具有正确 ID 的元素。在此修改后的方法中,将在整个页面中搜索具有正确 ID 的元素。
如果您不想覆盖所有页面上的行为,您还可以基于 ui.tabs 小部件创建一个新小部件。请参阅:如何扩展 jquery ui 小部件? (1.7)
You can modify the JQuery-UI widget to decouple the tabs and the content panes with the following code:
In the tabs.ui widget, the _getPanelForTab method starts its search for an element with the correct ID within the tab div. In this modified method, the whole page is searched for an element with the correct ID.
You could also create a new widget based on the ui.tabs widget if you didn't want to override its behavior on all of your pages. See: How to extend a jquery ui widget ? (1.7)
您想将选项卡本身与内容窗格分开吗?这反而违背了使用选项卡式视图的目的;听起来您想要更像导航菜单的东西。
也就是说,您可能可以在 jQuery UI 选项卡上使用一些自定义 CSS 来完成您想要的任务。
基本示例: http://jsfiddle.net/mattball/eyQuM/
You want to separate the tab itself from the content pane? This rather defeats the purpose of using a tab-style view; it sounds like you want something more like a nav menu.
That said, you could probably accomplish what you want using some custom CSS on the jQuery UI tabs.
Basic example: http://jsfiddle.net/mattball/eyQuM/