jquery - hover / setInterval : undefined time lapse -
try use 'hover' function , setinterval same div : if hover div, setinterval starts.
have problem : seems 2 different divs, when hover second div, first 'waits' 1000 ms before starting 'setinterval' of second div. when hover second div, both of them stay current image, , after moment setinterval of second div starts. (i quick, not wait ms).
do know how that?
here's code :
var intval; img.bind('mouseenter', function(){ var = $(this); intval = setinterval(function(){ next(that); },1000); }).bind('mouseleave', function(){ var = $(this); clearinterval(intval); }); thanks lot.
by calling next() in mouseenter event should work.
var intval; img.bind('mouseenter', function(){ var = $(this); next(that); intval = setinterval(function(){ next(that); }, 1000); }).bind('mouseleave', function(){ var = $(this); clearinterval(intval); });
Comments
Post a Comment