Reputation: 439
can i use setInterval twice in .hover()? is yes how is it possible??
wht i have in .hover is::
var target = evt.target;
if (target.timer) {
clearTimeout(target.timer);
target.timer = null;
}
target.timer = setInterval(function() {
$('.'+item).addClass(item+'- over2');},
500,
function() {$('.'+item).removeClass(item+'-over2');},1000);$('.'+item).addClass(item+'-over1');
Now inside this hover, i need to set another time delay to remove both classes -over1 and -over2
How is this possible??
Any help is highly appreciable
Upvotes: 0
Views: 391
Reputation: 7620
You can use several setTimeout or setIntervall after each other, but each will return it's own handler so you need seperate variables to store them if you need to reference them.
But remember, setIntervall starts a repeating call to the method that will be called repeatedly every intervall.
So for hiding some popup you probably want setTimeout.
Alternative jQuery methods:
http://api.jquery.com/category/effects/
http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery
Upvotes: 1