Easy way to do button blink with class.
Created
February 27, 2015 21:16
-
-
Save ezos86/b5fb73a7296c2484af6c to your computer and use it in GitHub Desktop.
Button Blink
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
<div class="box"></div> |
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
$('.box').click(function(){ | |
$(this).toggleClass('active'); | |
}); |
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
@import "compass/css3"; | |
html{ | |
margin:20px; | |
} | |
.box{ | |
width:100px; | |
height:100px; | |
background-color:red; | |
} | |
.active{ | |
background-color:blue; | |
//box-shadow: 0 0 10px red; | |
-webkit-animation: blink 1.0s linear infinite; | |
-moz-animation: blink 1.0s linear infinite; | |
-ms-animation: blink 1.0s linear infinite; | |
-o-animation: blink 1.0s linear infinite; | |
animation: blink 1.0s linear infinite; | |
} | |
@keyframes blink { | |
0% { box-shadow: 0 0 30px red; } | |
50% { box-shadow: none; } | |
100% { box-shadow: 0 0 30px red; } | |
} | |
@-webkit-keyframes blink { | |
0% { box-shadow: 0 0 30px red; } | |
50% { box-shadow: 0 0 0; } | |
100% { box-shadow: 0 0 30px red; } | |
} | |
/* Chrome, Safari, Opera */ | |
@-webkit-keyframes glow { | |
from {box-shadow: 0 0 0 red;} | |
to {box-shadow: 0 0 30px red;} | |
} | |
/* Standard syntax */ | |
@keyframes glow { | |
from {box-shadow: 0 0 0 red;} | |
to {box-shadow: 0 0 30px red;} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment