jQuery 选项卡 - 需要“全部” 带有整个表单的选项卡和每个表单部分的单独选项卡
我尝试用谷歌搜索我的要求,但没有运气。 我所拥有的是一个分为几个选项卡的表单,所有选项卡都运行良好。 但是,现在除了每个部分的单独选项卡之外,我还被要求提供整个表单的“全部”选项卡。
似乎是一个相当简单的请求,但我不知道如何使用 jQuery 选项卡功能来实现它?
I've tried to google my requirement but without luck. What I have is a form that is broken into several tabs, all which works perfectly. However, now I've been asked to provide an 'All' tab with the whole form, in addition to the individual tabs for each section.
Seems like a fairly straightforward request, but I can't see how I can implement it using the jQuery tabs functionality?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我对 jQuery 比较陌生,所以可能有更好的方法。 但如果我必须自己实现这一点,我会考虑重新调整 选项卡的
选择
事件。I'm relatively new to jQuery so there might be a much better approach. But if I had to implement this myself I would look into reparenting the contents of the "tab divs" in the
select
event of the tab.我认为 Ken 的做法是正确的,但我可能只是克隆适当的 DOM 元素。 如果有表单,您可能需要一次提交而不是多次提交,因此重新设置父级并不理想。
如果您的选项卡根据内容扩展,克隆它们还可以使高度和大小更加一致。
也许看看以下内容:
http://www.evotech.net /blog/2008/11/jquery-tutorial-dom-manipulation-and-sorting/
另一方面,重新设置父级可以避免每个屏幕之间可能出现的任何同步问题。
I think Ken is on the right trail, but I might just clone the appropriate DOM elements. If there are forms, you're going to probably want a single submit instead of multiple so reparenting isn't ideal.
Cloning them will also keep the height and sizing more consistent if your tabs expand based on the contents.
Maybe look at the following:
http://www.evotech.net/blog/2008/11/jquery-tutorial-dom-manipulation-and-sorting/
On the other hand, re-parenting avoids any synchronization issues you might have between each screen.
对于“选项卡”按钮来说,隐藏不属于该“选项卡”的所有表单元素可能更容易,而不是拥有实际的选项卡。
Rather than having actual tabs, it might be easier for your 'tab' buttons to just hide all form elements that are not part of that 'tab'.