【发布时间】:2015-02-02 06:27:12
【问题描述】:
希望每 5 秒运行一次函数 a,但在完全加载的文档上执行主函数后仅 3 秒。
jQuery(document).ready(function() {
setTimeout(function() {
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', 'engine_start.mp3');
audioElement.setAttribute('autoplay', 'autoplay');
//audioElement.load()
$.get();
audioElement.addEventListener("load", function() {
audioElement.play();
}, true);
$('.car').click(function() {
audioElement.play();
});
}, 3000);
function a {
setTimeout(function() {
$('.light').attr("src","images/light-on.png");
}, 2500);
}
【问题讨论】:
-
你遇到了什么错误???
-
它运行良好,但没有循环运行。/...如何再次运行函数A一次
-
为什么总是把图片源换成同一张图片?
标签: jquery recursion settimeout