HTML 5videoOnEnded事件未触发
我正在尝试对video
代码的HTML 5 onended
事件做出反应,但没有成功。 在下面的代码片段中,我添加了mouseleave事件以确保jQuery代码是正确的,并且该事件确实激活了alert()
框。
video播放得很好,但我没有收到onended
事件(我的alert()
不会触发)。
在Chrome中进行测试,今天更新至5.0.375.55版。
$(document).ready(function(){ $("#myVideoTag").bind('mouseleave onended', function(){ alert("All done, function!"); }); });
确保你绑定到ended
事件而不是onended
,总是在与jQuery绑定时保持on
,例如你不能做.on("onclick")
,你做.on("click")
。
如果有帮助,可以在此处找到 元素的完整可用事件列表: http : //www.w3.org/2010/05/video/mediaevents.html
我也在寻找答案。 以下是jQuery移动框架的用途:
$(document).ready(function(){ $("#idname").bind('ended', function(){ $.mobile.changePage($('#idofpageyouwantogoto'), 'fade'); }); });