Created
January 12, 2012 15:07
-
-
Save abackstrom/1601019 to your computer and use it in GitHub Desktop.
P2 jQuery.animate() fixes: transparency and callback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: js/p2.js | |
=================================================================== | |
--- js/p2.js (revision 8687) | |
+++ js/p2.js (working copy) | |
@@ -141,9 +141,10 @@ | |
var cnt = newComment.contents(); | |
newComment.children('li.newcomment').each(function() { | |
if (isElementVisible(this) && !showNotification) { | |
- $(this).animate({backgroundColor:'transparent'}, {duration: 1000}, function(){ | |
- $(this).removeClass('newcomment'); | |
- }); | |
+ $(this).animate({backgroundColor:'transparent'}, {duration: 1000, complete: function(){ | |
+ // jquery-color fades to white, not transparent | |
+ $(this).removeClass('newcomment').css({backgroundColor:''}); | |
+ }}); | |
} | |
bindActions(this, 'comment'); | |
}); | |
@@ -821,16 +822,17 @@ | |
function removeYellow() { | |
$('li.newcomment, tr.newcomment').each(function() { | |
if (isElementVisible(this)) { | |
- $(this).animate({backgroundColor:'transparent'}, {duration: 2500}, function(){ | |
- $(this).removeClass('newcomment'); | |
- }); | |
+ $(this).animate({backgroundColor:'transparent'}, {duration: 2500, complete: function(){ | |
+ $(this).removeClass('newcomment').css({backgroundColor:''}); | |
+ }}); | |
} | |
}); | |
if (isFirstFrontPage) { | |
$('#main > ul > li.newupdates').each(function() { | |
if (isElementVisible(this)) { | |
- $(this).animate({backgroundColor:'transparent'}, {duration: 2500}); | |
- $(this).removeClass('newupdates'); | |
+ $(this).animate({backgroundColor:'transparent'}, {duration: 2500, complete: function(){ | |
+ $(this).removeClass('newupdates').css({backgroundColor:''}); | |
+ }}); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment