]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Using event bubbling instead of event handling thanks to Ara
authorSarven Capadisli <csarven@controlyourself.ca>
Sun, 24 May 2009 01:38:11 +0000 (01:38 +0000)
committerSarven Capadisli <csarven@controlyourself.ca>
Sun, 24 May 2009 01:38:11 +0000 (01:38 +0000)
Pehlivanian http://arapehlivanian.com

js/util.js

index 2dfaafd76883d5f9aa17414d5be338fff12b3eec..baa3f119efac9ccbac9c582265a011c6413a8543 100644 (file)
@@ -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() {