hover - jQuery setInterval / hovering : it works once, but then stops the setInterval -
have problem 'setinterval' function, i'd start function when i'm hovering div, setinterval work @ first time when hover div => if i'm staying on div, doesn't keep on changing picture, stop 'setinterval'.
is problem mouseenter? tried 'hover', etc. nothing seems make trick.
does have solution?
thanks lot help, here's code :
img.bind('mouseenter', function(){ setinterval(next($(this)),1000); }); function next(elem){ var img_li = elem.find('li'); count++; if (count>2) count=0; img_li.eq(count).fadein('fast', function(){ img_li.eq(current).css({'display':'none'}); current = count; }); }
it because assigning return value of next($(this)) setinterval , not function itself.
try this:
img.bind('mouseenter', function(){ var = $(this); //use that-this model avoid scope issues reference setinterval(function(){ next(that); },1000); });
Comments
Post a Comment