352Media/flexMenu

Close menu when something other than the menu is clicked

Closed this issue · 4 comments

When something other than the flexMenu is clicked (e.g., when the background is clicked), close the flexMenu.

I've added this:

$moreLink.on("blur", function(){
    setTimeout(function(){
        $moreItem.removeClass('active');
        $popup.hide();
    }, 250);
} );

Thank you! I'll use that as a starting point and see if I can work that into the plugin.

What's the reason for the timeout? Maybe I'm missing something, but I'd expect the menu to be hidden immediately.

The solution above wasn't working for me, so I came up with this. Hope it can help someone else!

$(document).click(function(e) {
if ($(e.target).closest('.flexMenu-viewMore').length === 0) {
		$moreItem.removeClass('active');
		$popup.hide();
	}
});

Archiving this repo and closing all open issues. Thank you so much for your feedback - see you around the internet!! 🙂