jquery timeout function not working properly
Posted
by 3gwebtrain
on Stack Overflow
See other posts from Stack Overflow
or by 3gwebtrain
Published on 2010-04-21T09:47:17Z
Indexed on
2010/04/21
10:23 UTC
Read the original article
Hit count: 339
jQuery
|JavaScript
HI,
i ma using the settimeout function to display block and append to 'li', once the mouseover. and i just want to remove the block and make it none.
in my funcation works fine. but problem is even just my mouse cross the li, it self the block getting visibile. how to avoid this?
my code is:
var thisLi;
var storedTimeoutID;
$("ul.redwood-user li,ul.user-list li").live("mouseover", function(){
thisLi = $(this);
var needShow = thisLi.children('a.copier-link');
if($(needShow).is(':hidden')){
storedTimeoutID = setTimeout(function(){
$(thisLi).children('a.copier-link').appendTo(thisLi).show();
},3000);
}
else {
storedTimeoutID = setTimeout(function(){
$(thisLi).siblings().children('a.copier-link').appendTo(thisLi).show();
},3000);
}
});
$("ul.redwood-user li,ul.user-list li").live("mouseleave", function(){
clearTimeout(storedTimeoutID);
//$('ul.redwood-user li').children('a.copier-link').hide();
$('ul.user-list li').children('a.copier-link').hide();
});
© Stack Overflow or respective owner