jQuery Blink Improvements
This file contains 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
//Non-Plugin Function | |
var doBlink = function(obj,start,finish) { | |
jQuery(obj).fadeOut(300).fadeIn(300, function() { | |
if(start!=finish) { | |
start=start+1; | |
doBlink(obj,start,finish); | |
} | |
}); | |
}; | |
//jQuery Blink Plugin | |
jQuery.fn.blink = function(start,finish) { | |
return this.each(function() { | |
doBlink(this,start,finish) | |
}); | |
}; | |
//Note: Blink Plugin relies on doBlink function to work. | |
//Note: doBlink function can also be used without plugin | |
//Example: Without Plugin (Will Blink Eight Times) | |
doBlink("#myObject", 1, 8); | |
//Example: With Plugin | |
jQuery("#myObject").blink(1,8); | |
// For infinite blink | |
jQuery("#myObject").blink(1, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment