I’m unsure why my code triggers the fadeOut() effect if the menu is already open? See code below:
$('.rtmenu').click(function(e) { e.stopPropagation(); });
$('.rtmenu').mouseout(function(){
$(document).one('click',function() { $('.rtmenu').fadeOut(200); });
})
Any help would be greatly appreciated
The code you have should work provided it’s located inside a
document.readyand the.rtmenuelements aren’t being created dynamically. You can test it here.If they’re created dynamically, change it up a bit using a
.live()handler and.stopImmediatePropagation(), like this:You can give it a try here