问题描述
以下哪种最好的脚本制作方式可以使我在滑块中播放Vimeo或Youtube视频时可以停止滑块的滑动?
Which the best way to have a script that I can stop the slider slide when I play Vimeo or Youtube video in the slider?
非常感谢您的帮助.
jQuery(document).ready(function(){
jQuery('#gdl-custom-slider ul').cycle({
before: before_transition,
after: after_transition,
fx: 'fade',
pager: '#custom-slider-nav',
speed: CUSTOM.speed,
timeout: CUSTOM.timeout
});
function before_transition(curr, next, opts, fwd){
jQuery(next).find('.custom-slider-title').css({'top':'15px','opacity':'0'});
jQuery(next).find('.custom-slider-caption').css({'top':'15px','opacity':'0'});
}
function after_transition(curr, next, opts, fwd){
jQuery(this).find('.custom-slider-title').delay(100).animate({'top':'0px','opacity':'1'}, 200);
jQuery(this).find('.custom-slider-caption').delay(400).animate({'top':'0px','opacity':'1'}, 200);
}
});
推荐答案
您必须使用Vimeo和Youtube播放器API.
You have to use Vimeo and Youtube player APIs.
要打开API,请在iframe
的URL上添加api=1
,如下所示:
To turn the API on, add api=1
to the URL of the iframe
, like this:
http://player.vimeo.com/video/VIDEO_ID?api=1
更多信息 此处 .
要打开API,请在iframe网址中添加?version=3&enablejsapi=1
.
To turn the API on, add ?version=3&enablejsapi=1
to the iframe url.
http://www.youtube.com/v/VIDEO_ID?version=3&enablejsapi=1
在 文档页面 上查看更多信息.
See more information on the documentation pages.
单击开始"按钮时,您将停止滑块,而当您单击开始"按钮时,您将启动滑块.
When clicking "Start" button you will stop the slider, and when you will click the "Start" button you will start the slider.
这篇关于在滑块中播放Vimeo或Youtube视频时停止滑动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!