I have some prices that adjust based on radio button selections. I know how to make the numbers change based on the selections, but how do I simultaneously make them flash to grab the eye of the user?
I tried this: https://stackoverflow.com/a/11915453/5067193
And it works for the first radio button change, but not for any subsequent changes. I want it to flash every time the radio button selection changes.
Edit:
I found the answer that worked for me:
I had to add a setTimeout function so now my jquery code looks like (replace jq for $):
jq("input:radio").click(function(){
console.log('radio clicked');
jq("#price").addClass("flash");
setTimeout( function(){
jq("#price").removeClass("flash");
}, 1000);
});
and my css for flash at the moment looks like:
.flash{
-moz-animation: flash 1s ease-out;
-moz-animation-iteration-count: 1;
-webkit-animation: flash 1s ease-out;
-webkit-animation-iteration-count: 1;
-ms-animation: flash 1s ease-out;
-ms-animation-iteration-count: 1;
}
@-webkit-keyframes flash {
0% { color:transparent;}
50% { color:#FFF;}
100% {color:transparent;}
}
@-moz-keyframes flash {
0% { color:transparent;}
50% { color:#FFF;}
100% {color:transparent;}
}
@-ms-keyframes flash {
0% { color:transparent;}
50% { color:#FFF;}
100% {color:transparent;}
}