public
Created

P2 jQuery.animate() fixes: transparency and callback

  • Download Gist
gistfile1.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
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:''});
+ }});
}
});
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.