set/clear interval issue
- by 3gwebtrain
HI,
i am using the following code to show a link which is inside the li element. the constrain is, once the mouse enter into li element, and if it's stay inside 3sec, then it need to show. once i leave from li element, immateriality it should hide. for this, i am using :
var showTimeOut;
var thisElement
$('.user-list li').live('mouseover',function(){
thisElement = $(this).children('a.copier-link');
showTimeOut = setInterval(function(){
thisElement.css({'display':'block'});
},3000);
})
$('.user-list li').live('mouseleave',function(){
clearInterval(showTimeOut);
thisElement.hide();
})
It's work fine. But the problem is, while i cross the li element with just a second, even the interval is calling, and showing the link. but i need to show only, if i stay inside 3sec and it need to hide there after, again i stay back 3sec.
anything wrong with my code?, else any one give me the best suggestion?
Thanks.