Jikey
Jikey

Reputation: 41

Stop sliding when play Vimeo or Youtube video in the slider

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?

very much appreciated with you all help.

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

Upvotes: 1

Views: 5234

Answers (1)

Ionică Bizău
Ionică Bizău

Reputation: 113335

You have to use Vimeo and Youtube player APIs.

Vimeo

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

More information here.


Youtube

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

DEMO

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.

Upvotes: 2

Related Questions