Mootools视频“结束”绑定无法正常工作

时间:2012-04-30 20:50:41

标签: javascript jquery mootools

我需要将一个有效的jQuery脚本迁移到Mootools以满足我的项目要求。

工作的jquery代码是:

$('#video').bind('ended', function() {
  //Functions on end here.
});

我在Mootools上尝试了以下内容......

document.id('video').addEvent('ended', function () {
    //Functions here
});

document.id('video').addEvent('ended', function () {
    //Functions here
}.bind(this)); 

但是没有效果:(任何人都能指出正确的方向吗?

谢谢!

1 个答案:

答案 0 :(得分:1)

MooTools不支持HTML5媒体标记事件。添加块written here后,您可以使用:

$('myVideo').addEvent('ended', function(){
//Functions here
});

此处 myVideo 是标记的ID:

<video id="myVideo"></video>