Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/91.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jQuery在10秒后播放视频_Jquery_Html - Fatal编程技术网

使用jQuery在10秒后播放视频

使用jQuery在10秒后播放视频,jquery,html,Jquery,Html,我想在10秒后播放视频。setTimeOut的功能似乎不起作用。 这是javascript函数: $('.top').toggle( 3000 ); $('.top1').delay(3000).toggle(3000); setTimeout(function(){ $(".video").play(); }, 6000); html部分: <video class="video" width="700" height="700"> <source src

我想在10秒后播放视频。setTimeOut的功能似乎不起作用。 这是javascript函数:

$('.top').toggle( 3000 );
$('.top1').delay(3000).toggle(3000);
setTimeout(function(){
    $(".video").play();
}, 6000); 
html部分:

<video class="video" width="700" height="700">
    <source src="images/video9.mp4" type="video/mp4">
    <source src="imagesvideo9.ogg" type="video/ogg">
</video></div>
<img class="top" src="images/boot.png" style="display:none; hidden; position:absolute; left:-1%; top:8.5%;" width="710" />
<img class="top1" src="images/boot1.png" style="display:none; position:absolute; left:-1%; top:75%;" width="710"/>

方法在HTMLVideoElement上,而不是jQuery对象上。试试这个:

setTimeout(function(){
    $(".video")[0].play(); // note the [0] to access the native element
}, 10000); // 10 seconds = 10000 ms

你能详细说明什么东西不起作用吗?