2
Look at
function rodarslider(){
(...)
caption.classList.remove('sliderfect');
caption.classList.add('sliderfect');
(...)
}
The above function is the little chunk of the algorithm of a pure JS slider that I’m doing.
caption
- is the variable that stores the figurecaption of my slider.
sliderfect
- is the class that changes the caption position from direct to left with 1 second Transition and takes the display:none
, animate.
My intention is to have the class removed in a single click event immediately after being put back into effect. Only that doesn’t happen.
It would be easy if there were two events, example: onmouseover
adds the class and onmouseout
class. The challenge (for me) is to cause this excitement in one event every click.
If it wasn’t clear I made this mini version of my script http://jsfiddle.net/hnnv8u1c/6/
So maybe you could use the
.setTimeout
sort of like this:caption.classList.add('sliderfect'); setTimeout(function(){ caption.classList.remove('sliderfect'); }, 1500);
where 1500 would be the duration in milliseconds of the effect so that then run the event that removes the effect. (all this in the onclick event)– Paulo Roberto Rosa
Would this be the result you wanted? @ropbla9
– Paulo Roberto Rosa
@Pauloroberto Should stop. I think it’s best to put each title in a separate <H1> with display:None. This way with an array to get to where I want.
– ropbla9
I couldn’t understand @ropbla9
– Paulo Roberto Rosa
@Pauloroberto you gave a pause of 1 second inside the function, but soon after the title disappears. That is, I think it’s better to put some invisible <H1> in HTML and discover one at a time.
– ropbla9
@ropbla9 ok, I just saw your jsFiddle. You are using
transition
in a strange way. Can you explain what you want to achieve? or whatever effect you want and don’t have on jsFiddle now?– Sergio