jQuery单击时如何停止Vimeo视频 [英] jQuery how to stop Vimeo video when click

查看:16
本文介绍了jQuery单击时如何停止Vimeo视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是简单的代码: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');
});

推荐答案

我不知道完成这个跨浏览器的好"或正确"方法.
Youtube 的 JavaScript API 也失败了.

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

但是这种方法是可靠的并且确实有效.
基本上,它会杀死 <iframe> 并重建它.

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());
});

在 JSFiddle 上查看

这篇关于jQuery单击时如何停止Vimeo视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆