$.fn.blink = function(property, newValue, duration) { var originalPropertyValue = this.css(property); this.animate({property: newValue}, 100) .animate({property: originalPropertyValue}, duration - 100, function() {$(this).css(property, originalPropertyValue);} ); };