Created
April 9, 2010 08:15
-
-
Save hokaccha/360980 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html lang="ja" xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta charset="UTF-8" /> | |
</head> | |
<body> | |
<div class="blink">hoge</div> | |
<script type="text/javascript" src="js/jquery.js"></script> | |
<script type="text/javascript" src="js/jquery-blink.js"></script> | |
<script type="text/javascript"> | |
$('.blink').blink(); | |
</script> | |
</body> | |
</html> |
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
$.fn.blink = function(speed) { | |
var interval = 500000 / (speed || 1000); | |
return this.each(function() { | |
var elem = $(this); | |
var opacity = 1; | |
setInterval(function() { | |
opacity = opacity ? 0 : 1; | |
elem.css('opacity', opacity) | |
}, interval); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment