Hover example: close submenus when user clicks on the page
ivansammartino opened this issue · comments
Ivan commented
Version
version: 2.7.0
Description
I noticed that clicking on main menu items in the "hover" example keeps the menu opened even if I go around the page: this is very fine, but when the user clicks on the page body I'd expect the submenus to close... how can I achieve this?
Thank you :-)
samarthpathak3 commented
Hello, you need to use jquery event propagation method.
$(document).ready(function()
{
$("body").mouseup(function(e)
{
var subject = $("#yourMetisMenuUl");
if(e.target.id != subject.attr('id') && !subject.has(e.target).length)
{
subject.hide();
}
});
});