为什么我的简单 JQuery 代码中没有绑定事件?- http://pastebin.com/24J6q5G0
相关部分:
<div class="videoWrapper">
<video controls preload autoplay>
<source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4">
<source src="http://techslides.com/demos/sample-videos/small.ogv" type="video/ogg">
</video>
</div>
<div class="videoWrapper">
<video controls preload="none">
<source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4">
<source src="http://techslides.com/demos/sample-videos/small.ogv" type="video/ogg">
</video>
</div>
和javascript:
$(document).ready(function() {
var vid0 = $(document.getElementsByClassName('videoWrapper')[0]);
var vid1 = $(document.getElementsByClassName('videoWrapper')[1]);
vid1.hide();
vid0.bind('ended', function() {
vid1.show();
})
})
(当 HTML5 视频结束时,我一直在关注Detect)