7
It is possible to control the number of executions of setInterval
? I made a script very simple where I wanted to div
flash 3x to alert the user. But in script that I made it keeps blinking straight.
<div id="my-div">alerta teste</div>
setInterval(function(){
$('#my-div').animate({'opacity':'toggle'})
},250);
And how would I delimit the spread of this event? For example. I click on a button that calls a popup that is applied this effect and if I click on the button more than once it will repeat the animation. I tried using a . stop(true) before Animate but so it does not apply the blinking effect
– Gabriel Schmidt Cordeiro
@Gabrielschmidtcorderly can you explain better what you want to do and it’s not working? do you mean to say that by clicking several times you want it not to accumulate? or do you want it to be just once and never again? or do you mean other buttons?
– Sergio
I want it not to accumulate when I click several times
– Gabriel Schmidt Cordeiro
@Gabrielschmidtcordeiro is what you’re looking for? -> http://jsfiddle.net/m5k3k86j/
– Sergio
Here is an example: http://jsfiddle.net/ivanferrer/ra0n3duz/
– Ivan Ferrer
That’s right Sergio, perfect. Thank you very much
– Gabriel Schmidt Cordeiro
@Gabrielschmidtcordeiro anything! I’m glad to help
– Sergio