diff options
author | Sarven Capadisli <csarven@controlyourself.ca> | 2009-05-24 01:38:11 +0000 |
---|---|---|
committer | Sarven Capadisli <csarven@controlyourself.ca> | 2009-05-24 01:38:11 +0000 |
commit | 7e0a314768fed3c5964e9d404d33a243277559ce (patch) | |
tree | 556a2352fa8c44434ed36fd792a6733004c48f87 /js/util.js | |
parent | 456f3eeb50fc1cafaa66ab5c0bdcdcaa5ca4bcd0 (diff) |
Using event bubbling instead of event handling thanks to Ara
Pehlivanian http://arapehlivanian.com
Diffstat (limited to 'js/util.js')
-rw-r--r-- | js/util.js | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/js/util.js b/js/util.js index 2dfaafd76..baa3f119e 100644 --- a/js/util.js +++ b/js/util.js @@ -203,7 +203,6 @@ $(document).ready(function(){ $("#notices_primary .notices").prepend(document._importNode(li, true)); $("#notices_primary .notice:first").css({display:"none"}); $("#notices_primary .notice:first").fadeIn(2500); - NoticeHover(); NoticeReply(); } } @@ -221,17 +220,16 @@ $(document).ready(function(){ NoticeReply(); }); + function NoticeHover() { - $("#content .notice").hover( - function () { - $(this).addClass('hover'); - }, - function () { - $(this).removeClass('hover'); - } - ); + function mouseHandler(e) { + $(e.target).closest('li.hentry')[(e.type === 'mouseover') ? 'addClass' : 'removeClass']('hover'); + }; + $('#content .notices').mouseover(mouseHandler); + $('#content .notices').mouseout(mouseHandler); } + function NoticeReply() { if ($('#notice_data-text').length > 0) { $('#content .notice').each(function() { |