<script type=text/javascript>
jQuery(function(){
jQuery('#webmenu li').hover(function(){
jQuery(this).children('ul').stop(true,true).show('normal');
},function(){
jQuery(this).children('ul').stop(true,true).hide('slow');
});
});
</script>这是一段弹出菜单的代码,百度了一下说是用SET TIMEOUT的方法做延迟.可是搞了半天也没搞出来.麻烦各位帮忙改一下.谢谢了只是希望鼠标放上去的时候不是马上执行.而是延迟一下再执行.
jQuery(function(){
jQuery('#webmenu li').hover(function(){
jQuery(this).children('ul').stop(true,true).show('normal');
},function(){
jQuery(this).children('ul').stop(true,true).hide('slow');
});
});
</script>这是一段弹出菜单的代码,百度了一下说是用SET TIMEOUT的方法做延迟.可是搞了半天也没搞出来.麻烦各位帮忙改一下.谢谢了只是希望鼠标放上去的时候不是马上执行.而是延迟一下再执行.
function myOperation(){
alert(1111);
//jQuery(this).children('ul').stop(true,true).show('normal');
}jQuery(function(){
jQuery('#mydiv').hover(function(){
t = setTimeout("myOperation()",1000);
})
});
<script type=text/javascript>
jQuery(function(){
jQuery('#webmenu li').hover(function(){
jQuery(this).children('ul').stop(true,true).show('normal');
},function(){
jQuery(this).children('ul').stop(true,true).hide('slow');
});
});
</script>
这个原来的代码里应该是改为什么呢?我对JQuery不是很了解。谢谢你了。
jQuery('#webmenu li').hover(
function(){
//鼠放悬浮其上时,延迟一秒显示
var _that=jQuery(this);
setTimeout(function(){
_that.children('ul').stop(true,true).show('normal');
},1000);
},function(){
//鼠放离开后,延迟一秒隐藏
var _that=jQuery(this);
setTimeout(function(){
_that.children('ul').stop(true,true).hide('slow');
},1000);
}
);
});PS:这个跟jQuery木有啥米关系的。基础问题,Lz你其实稍用点心,上网查查setTimeout的用法,你自己自然就会用。想学就不用这么懒的