开发者

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. Thanks


You 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜