JQuery.live () does not work with HTML5 video album

I'm having trouble interacting with a completed HTML5 video event. The problem is that the tag is dynamically added to the page using the lightbox-clone plugin, and I cannot use bind to get the completed event. I tried using live (), but that didn't work either. I can, of course, use "click" as an event, but neither the game, nor the pause, nor the termination will work. I tried the delegate, but that did not help.

The code looks something like this (I used a solution located elsewhere in Stackoverflow):

$("video").live("play", function() {
    alert("It moves!");
});

Using bind has the desired effect, but does not affect the video tag inside the popup container. HTML is a standard tag <video>enclosed in a div, but if you need it, I can enable it.

Can anyone think of a workaround for this, or simply can't be done? I'm new to jQuery, so maybe I missed something obvious here. I am using the old version of jQuery (1.3.2), but also testing on 1.6.1 without any results.

+5
source share
2 answers

I think the method is livebased on event bubbles. Only events that bubbles can be captured using the method live. There is no standard message that tag events videoshould bubble, so I think browsers implement these events in a non-bubble way. This means that you must bindcreate every videoelement that you create.

+5

delegate ? , live. body .

$('body').delegate('video','play',function() {
    alert('it moves!');
});

jsfiddle , , , ...

: - , jquery.

0

All Articles