[英]How to add delay to a function
$(function(){
$('#slides_left').slides({
generateNextPrev: false,
play: 5500
});
});
How can I add a .delay() to the function above so that the starting time for the function is not onload rather to a specified time? 如何在上面的函数中添加.delay(),以使函数的开始时间不加载,而是指定时间?
sorry for my noobness in jQuery! 对不起,我对jQuery不满意!
Thanks! 谢谢!
you can use javascript setTimeOut function 您可以使用javascript setTimeOut函数
setTimeout(functionname, 2000); // replace 2000 with your number of millisecond required for delay.
Call this setTimeout inside onload. 在onload中调用此setTimeout。
Cheers!! 干杯!!
$(function(){
// Start after 3 seconds
window.setTimeout('doSlide()', 3000);
});
function doSlide(){
$('#slides_left').slides({
generateNextPrev: false,
play: 5500
});
};
There is also a pause option for slides(). slides()也有一个暂停选项。
Use setTimeout
使用setTimeout
$(function(){
setTimeout(function(){
$('#slides_left').slides({
generateNextPrev: false,
play: 5500
});
}, 1000);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.