多级下拉上下文菜单
我正在为 jQuery 制作一个上下文(右键单击)菜单插件,它在第一级工作得很好。但我需要它有无限的水平。我已经有了递归,但我认为这是显示/隐藏的问题。到目前为止,这是我的代码: http://jsfiddle.net/H7GqA/4/ (抱歉对于混乱的代码,插件是为我自己准备的)。第二级项目从未出现,我不确定我做错了什么。
预先感谢 - 坦纳。
I am making a context(right click) menu plugin for jQuery, and it works fine for the first level. But I need it to have infinite levels. I already have the recursion down, but I think it's a problem with the showing/hiding. This is my code, so far: http://jsfiddle.net/H7GqA/4/ (Sorry for the messy code, plugin's for myself). The second-level item never appears, and I'm not sure what i'm doing wrong.
Thanks in advance - Tanner.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
.submenu
元素上有display:none
,但您不执行任何操作来显示它们。如果您希望它们始终处于打开状态,
如果您想在其父级悬停时执行此操作,
请添加以下规则(对于现代浏览器)
我发现您有这段代码
应该可以工作(如果您取消注释第一行) 并将该代码移至
doMain
函数中。因为您当前拥有的#ContextMenu
元素尚不存在..所以绑定不会发生..You have
display:none
on the.submenu
elements and you do nothing to show them.If you want them to be always on add the following rule
if you want to do it on hover of their parent do
for modern browsers
I see the you have this code
the should work (if you uncomment the first line) and move that code in the
doMain
function. Because where you currently have it the#ContextMenu
element does not exist yet.. so the binding does not happen..