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?
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.
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.
<script type="text/javascript" language="javascript">
function HideMenuOnClick(item) {
var target;
if (item.target) {
target = item.target;
}
else if (item.srcElement) {
target = item.srcElement;
}
if (target.className.indexOf("StaticMenuItemStyle") == -1)
{
Menu_HideItems(item);
}
else
{
return false;
}
}
document.body.onclick = HideMenuOnClick;
</script>
精彩评论