【发布时间】:2013-01-09 02:03:40
【问题描述】:
我一直在研究我的问题,不想重复发布,但我尝试了研究中描述的方法,但无法延迟我的功能!!
谁能看看我的语法是否有问题以及为什么它不起作用?除了 setTimeout 函数之外,一切都运行良好
$(document).ready(function(){
$("#slider").easySlider({
auto: true,
continuous: true
});
$("#prevBtn a").hide();
$("#nextBtn a").hide();
$("#slider").mouseover(function(){
$("#prevBtn a").show();
$("#nextBtn a").show();
});
setTimeout(function(){
$("#prevBtn a").fadeOut('slow');
$("#nextBtn a").fadeOut('slow');
},3000);
});
【问题讨论】:
-
你能在jsfiddle中设置一个演示吗?
-
您的 setimeout 功能有效。我在里面放了一个console.log('hi'),我看到了。
-
你隐藏
#prevBtn a和#nextBtn a然后在setTimeout中淡出它们,你可能打算使用fadeIn (api.jquery.com/fadeIn) -
我不希望按钮在加载时显示,这就是为什么我在加载时隐藏它们。当用户将鼠标悬停在滑块上时,按钮就会出现。在鼠标移出时,我希望按钮在 3 秒后淡出..
-
.delay 仅适用于 1.4。我没有用那个
标签: javascript jquery function settimeout