如何防止 asp:menu 在单击时消失
我有一个 System.Web.UI.WebControls.Menu,当您单击顶层时,该菜单会被关闭。
请参阅截屏http://www.screencast.com/t/puCmErPVp
我不希望它单击时将被忽略。我希望菜单保持在下方。
菜单项由站点地图填充。
我可以使用 Menu 对象上的任何内容来获得此行为吗?也许我可以使用一些 javascript 或 CSS 来防止它消失?
I have a System.Web.UI.WebControls.Menu that is dismissed when you click on the top level.
See screencast http://www.screencast.com/t/puCmErPVp
I DO NOT want it to be dismissed when it is clicked. I want the menu to stay down.
The menu items are filled by a sitemap.
Is there anything on the Menu object that I can use to get this behavior? Perhaps there is some javascript or CSS I can use to prevent it from disappearing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来您有与 asp:menu 一起使用的第三方组件,如果是,您需要其源代码来修改
的悬停操作,如果没有,则有一些客户端 javascript 或 css 样式,你可以修改它们。
it seems you have third party component used with asp:menu, if yes you need its source code to modify hover action for
<li>
, if no, there are some client side javascripts or css styles, you can modify them.我用一些 JavaScript 修复了它。
基本上,之前发生的情况是 document.body.onclick 设置为 Menu_HideItems。我对其进行了更改,以便 document.body.onclick 会调用我自己的函数,并在隐藏菜单项之前检查您单击的内容。
I fixed it with some Javascript.
Basically, what was happening before was document.body.onclick was set to Menu_HideItems. I changed it so that document.body.onclick would call my own function and check to see what you were clicking on before hiding the menu items.