问题
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);
}
});
回答1:
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.
来源:https://stackoverflow.com/questions/17133994/stop-sliding-when-play-vimeo-or-youtube-video-in-the-slider