jQuery how to stop Vimeo video when click

jquery, jquery-plugins, vimeo

Solution

I don't know a "good" or "right" way to accomplish this cross-browser. Youtube's JavaScript API fails, too.

But this method is reliable and does work. Basically, it kills the `<iframe>` and rebuilds it.

$('a').click(function() {
  alert('stoped');
  vimeoWrap = $('#vimeoWrap');
  vimeoWrap.html(vimeoWrap.html());
});

View at JSFiddle

Problem

here is the simple code: http://jsfiddle.net/YAFuW/1/ basicly i tried to use like this: ``` <iframe src="http://player.vimeo.com/video/40977539?api=1" width="400" height="225" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> <a href="#">STOP</a> $('a').click(function() { alert('stoped'); froogaloop.api('unload'); }); ```

Original source