在滑块中播放 Vimeo 或 Youtube 视频时停止滑动 [英] Stop sliding when play Vimeo or Youtube video in the slider

查看:44
本文介绍了在滑块中播放 Vimeo 或 Youtube 视频时停止滑动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在滑块中播放 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,请将 api=1 添加到 iframe 的 URL,如下所示:

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 

JSFiddle

更多信息这里.

要开启 API,请将 ?version=3&enablejsapi=1 添加到 iframe 网址.

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 视频时停止滑动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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