请问如何规范使用setTimeout?该怎么修改?

$(document).ready(function(){
$(".sly li").hover(function() {
$(this).children(".sum").setTimeout(function(){
jQuery(this).children(".sum").animate({"top": "160px"}, 500, "swing")}
,1000);
},function() {
$(this).children(".sum").setTimeout(function(){
jQuery(this).children(".sum").animate({"top": "229px"}, 200, "swing")}
,1000);
});
});  
</script>

慕仙森
浏览 108回答 2
2回答

繁星coding

Timeout是浏览器环境下自带的函数,直接使用setTimeout(function(){},delay)或者,window.setTimeout(function(){},delay)即可,不是你这样使用的

富国沪深

setTimeout(function(){},等待的毫秒数)
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JQuery