Jquery菜单-切换问题
要查看问题所在,请参阅 jsFiddle 上的代码。有没有一种方法可以使用类“menutop”设置列表” 的作用类似于“toogle”类 (+),换句话说,当单击帖子、页面等子菜单时就会显示。
困扰我的第二件事是如何将菜单设置为当打开一个子菜单并且用户单击其他子菜单时,前一个打开的子菜单会自动关闭。
To see what is the trouble see code on jsFiddle.Is there a way to set list with class "menutop" to act like "toogle" class (+), in other words when click Posts, pages and so on submenu is revealed.
Second thing that bothers me is how to set menu to behave in way that when one submenu is opened, and user click some other submenu, the previous opened to be closed automatical.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在 Toogle 处理程序中命名了该函数,并从 menutop 中调用它,将切换类元素设置为“this”,这样您看起来更熟悉。
我刚刚添加了一行,确保一次只能打开一个部分
I named the function in the toogle handler and called it from menutop setting the toggle class element as "this" so it looks more familiar to you.
I just added a line that ensures that only one section could be open at a time
这是一个修订版。 添加了关闭所有功能,然后我还为菜单顶部添加了单击处理程序类本质上做同样的事情来展开选项卡。希望有帮助!
Here's a revision. Added a close all function and then I also added a click handler for the menu-top class that does essentially the same thing to expand the tabs. Hope it helps!