在 jQuery UI 选项卡之间共享元素?
我使用 jQuery UI 的选项卡来划分页面上的内容。我有一个“链接栏”,我想挂在每个选项卡的底部。 (选项卡文本会发生变化,但通常它们会通过选项卡向左或向右导航用户。)
在第一个选项卡内托管 #linkBar div 使其在 Themeroller 的边框内“看起来”正确。将其放在“父选项卡”div 的外部会将链接放置在主题边框下方。我尝试创建一个间隔 div,但它只是将 #linkBar 进一步向下推。
当然,当用户切换到另一个选项卡时,链接栏就会消失。选项卡之间的元素所有权是如何组织的?我是否应该动态销毁正在导航的选项卡上的 #linkBar div 并在正在导航到的选项卡中重建它?或者是否有更好的方法在它们之间移动它,或者只是管理可见性?
我想让链接栏作为页脚跟随每个选项卡上的内容,“浮动”每个选项卡最后内容下方的一两行(而不是将其放置在相对于选项卡栏的固定位置)。
I'm using jQuery UI's tabs to divide content on my page. I have a 'link bar' I would like to have hang at the bottom of each tab. (The tab text will change but generally they will navigate the user left or right through tabs.)
Hosting the #linkBar div inside the first tab makes it 'look' right, inside Themeroller's border. Putting it just outside the 'parent tab' div places the links below the theme's border. I've tried creating a spacer div but it just pushes #linkBar down further.
Of course when the user switches to another tab, the link bar goes away. How is ownership of elements organized between tabs? Should I dynamically destroy the #linkBar div on the tab being navigated away from and rebuild it in the tab being navigated to? Or is there a better way to move it between them, or just manage visibility?
I would like to have the link bar follow the content on each tab as a footer, 'floating' one or two lines below the last content of each tab (rather than having it in a fixed position relative to the tab bar).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的...只是将 jQuery UI 类添加到 linkBar 中。 查看我的 jsFiddle 演示:
我将
linkBar
div 从tabOne
div 中移出,并将其放在tabs
div 的底部:我稍微更改了
linkBar< /code> 通过给它一个顶部样式和底部边距以及默认隐藏它:
然后我只需将 jQuery UI 类添加到
$linkBar
中。我稍微修改了 jQuery 以使其更具可读性:注意:您只需将
class="ui-tabs-panel ui-widget-content ui-corner-bottom"
添加到linkBar
div 并完成它。但是,我想我喜欢在 JS 中更好地管理它。Ok ... It was simply adding the jQuery UI classes to the linkBar. Check out my working jsFiddle demo:
I moved the
linkBar
div out of thetabOne
div and put it at the bottom of thetabs
div:I slightly altered the
linkBar
style by giving it a top and bottom margin as well as hiding it by default:Then I simply added the jQuery UI classes to the
$linkBar
. I slightly altered the jQuery to be more readable:Note: You could just add
class="ui-tabs-panel ui-widget-content ui-corner-bottom"
to thelinkBar
div and be done with it. But, I think I like it better managed in the JS.