jquery UI 选项卡使用 DIV 而不是 UL 进行导航
我对 JS 有点陌生,这让我抓狂了。
我想使用内部带有一堆锚点的 DIV 进行导航,而不是强制的(我认为?)UL。
我找到了执行此操作的代码段,但我似乎无法理解它。
this.list = this.element.children('ul:first');
this.lis = $('li:has(a[href])', this.list);
this.anchors = this.lis.map(function() { return $('a', this)[0]; });
this.panels = $([]);
现在,将 更改
ul:first
为
div:first
有效,但我仍然必须将所有 A 包含在 LI 中。 这肯定发生在第二行,但我真的不知道该怎么办。
我知道这只是一个相当大的脚本的一小部分,但我希望它能做到。 所有代码都可以在 ui.jquery.com 上找到(您很可能已经知道),如果需要,我可以发布其余部分。
非常感谢您的帮助。
目标是用一个只包含 A 的 DIV 替换 UL 和 LI 这将使造型变得更加容易。
Im a little new to JS and this has got me scratching my head like crazy.
I want to use a DIV with a bunch of anchors inside for the navigation instead of the mandatory (I think?) UL.
I have found the piece of code that does this, but I can't seem to make any sense of it.
this.list = this.element.children('ul:first');
this.lis = $('li:has(a[href])', this.list);
this.anchors = this.lis.map(function() { return $('a', this)[0]; });
this.panels = $([]);
Now, changing the
ul:first
to
div:first
works, but I still have to wrap all my A's in a LI.
This must be happening in the second line, but I really can't figure out what to do with it.
I know this is a small bite of a rather large script, but I hope it will do.
All the code is available at ui.jquery.com (as you most likely already know) and I can post the rest of it if needed.
Many thanks in advance for your help.
The goal is to replace the UL and LI's with a single DIV that contains nothing but A's
This will make styling so much easier.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试这个。
Try this.