在滑块中播放Vimeo或Youtubevideo时停止滑动

当我在滑块中播放Vimeo或Youtubevideo时,哪种脚本可以阻止滑块滑动的最佳方法?

非常感谢大家的帮助。

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。

Vimeo的

要启用API,请将api=1添加到iframe的url,如下所示:

 http://player.vimeo.com/video/VIDEO_ID?api=1 

的jsfiddle

更多信息在这里


的Youtube

要启用API,请将?version=3&enablejsapi=1到iframeurl。

 http://www.youtube.com/v/VIDEO_ID?version=3&enablejsapi=1 

DEMO

请参阅文档页面上的更多信息。


单击“开始”按钮时,您将停止滑块,当您单击“开始”按钮时,您将启动滑块。