views:

936

answers:

2

I have a jquery slider that I have built, basically just three pannels that slide by applying negative left CSS values. Works great, but I have a youtube video in one slide that wont stop when I slide. I've tried display:none and Visibility:hidden which works in all but IE, the audio keeps going in IE.

Is there an easy way to kill a video with jquery?

+2  A: 

I've had this problem before and the conclusion I've come to is that the only way to stop a video in IE is to remove it from the DOM.

Felix
How would I go about that?
Wes
`$(playerDiv).remove();`
Adam Kiss
Great, and can I add it again somehow?
Wes
you could try `var playercopy = $(playerDiv).clone()` then `$(playerDiv).remove()`
cobbal
@cobbal: You can just do `var $player = $(playerDiv).detach();`
Matt Ball
+2  A: 

from the API docs:

player.stopVideo()

so in jQuery:

$('#playerID').get(0).stopVideo();
cobbal
Wes
cobbal