How do I add a exception to the document for a menu system, using JQuery?
How do I add exceptions to the document?
For example within DIV(.rtmenu) I want to exclude links with the class (a.menu-arrow). So if I click/mousedown on (a.menu-arrow)...the DIV(.rtmenu) doesn't fadeOut?$('.rtmenu').live('click', function(e) { e.stopImmediatePropagation(); });
$(d开发者_运维百科ocument).mousedown(function() { $('.rtmenu').fadeOut(200); });
Any help is greatly appreciated. ThanksYou can add a stop propgation to the menu links as well, like this:
$('.rtmenu').live('click', function(e) { e.stopImmediatePropagation(); });
$('.a-menu-arrow').live('mousedown', function(e) { e.stopImmediatePropagation(); });
$(document).mousedown(function() { $('.rtmenu').fadeOut(200); });
You could try the .not()
function:
$('.rtmenu').not('a.menu-arrow').live(...
http://api.jquery.com/not-selector/ You'll need to use :not
精彩评论