【问题标题】:Stop sliding when play Vimeo or Youtube video in the slider在滑块中播放 Vimeo 或 Youtube 视频时停止滑动
【发布时间】:2013-06-16 13:49:00
【问题描述】:

当我在滑块中播放 Vimeo 或 Youtube 视频时,有一个脚本可以停止滑块幻灯片的最佳方式是什么?

非常感谢大家的帮助。

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

【问题讨论】:

    标签: jquery video youtube slider


    【解决方案1】:

    您必须使用 Vimeo 和 Youtube 播放器 API。

    Vimeo

    要打开 API,请将 api=1 添加到 iframe 的 URL,如下所示:

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

    JSFiddle

    更多信息here。


    YouTube

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

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

    DEMO

    查看documentation pages的更多信息。


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

    【讨论】:

    • 谢谢你的回答....我还是不太明白..也许可以告诉我一些如何使它工作的例子?
    • @Jikey 请使用您的 html、CSS 和 javascript 创建一个 JSFiddle。
    猜你喜欢
    • 1970-01-01
    • 2011-05-18
    • 2011-08-30
    • 1970-01-01
    • 2017-09-03
    • 2022-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多