暂停Vimeo的通用嵌入使用jQuery时隐时现 [英] Pause Vimeo universal embed when hidden using jQuery
本文介绍了暂停Vimeo的通用嵌入使用jQuery时隐时现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有隐藏我的网页上Vimeo的视频(通过通用嵌入的iframe)。单击链接消失它,和视频(灯箱式)的点击之外淡出出来,并隐藏它 - 但视频继续播放。我读了,您可以使用JSON对象暂停Vimeo的视频的API ,但我不不懂他们在说什么。
HTML
< IMG ID =show_tide级=VIDSRC#>
< I< IFRAME ID =潮级=VIMSRC =http://player.vimeo.com/video/1747304?portrait=0&color=ffffffapi=1WIDTH =726HEIGHT =409FRAMEBORDER =0>&下; / iframe的>
JavaScript的:
$('#底层')。点击(函数(){
//暂停可见(有多个),通过API Vimeo的视频
$('。VIM,#underlay')淡出(400)。
});
解决方案
您需要从的 froogaloop库的。
JS
播放器= $ F(的document.getElementById('潮')); //你可以使用jQuery太:$('#潮')[0]
player.api(暂停);
烦人的简单。这里有jsfiddle.net 一个例子。
I have a Vimeo video (via universal embed iframe) hidden on my page. Clicking a link fades it in, and clicking outside of the video (lightbox-style) fades it out and hides it - but the video keeps playing. I read on Vimeo's API that you can use JSON objects to pause the video, but I don't understand what they're saying.
HTML:
<img id="show_tide" class="vid" src"#">
<i<iframe id="tide" class="vim" src="http://player.vimeo.com/video/1747304?portrait=0&color=ffffffapi=1" width="726" height="409" frameborder="0"></iframe>
JavaScript:
$('#underlay').click(function() {
//pause VISIBLE (there are multiple) Vimeo video via API
$('.vim, #underlay').fadeOut(400);
});
解决方案
You need to add from one of the froogaloop libraries.
JS
player=$f(document.getElementById('tide'));// you can use jquery too: $('#tide')[0]
player.api('pause');
Annoyingly simple. Here's an example on jsfiddle.net.
这篇关于暂停Vimeo的通用嵌入使用jQuery时隐时现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文