How to stop slider rotation at onclick event in Jquery Cycle plugin?
I am working with jquery cycle plugin and my slider contains embedded video. Now I need the plugin behavior such that when a user clicks on the video slide the slider s开发者_如何学编程hould stop and plays the video. Currently the video starts playing but it goes away as slider starts to rotate again. Here is my code:
$('.slideshow').cycle({
fx: 'scrollHorz',
timeout: 7000,
next: '#nextVideo',
prev: '#prevVideo',
pause: 1
});
Currently it pauses on hover. But I want it to be stopped once clicked.
Someone suggested this solution:
$('.slideshow').click(function(){
$(this).cycle('id').cycle('pause');
});
With this solution problem is it stops the slider and plays the video but slider next/previous buttons also stop working.
Therefore I am looking for a proper solution. Can anyone help?
Thanks in advance !
You just need to add this in your click event
$('id').cycle('pause'); /*Stop the Cycle plugin*/
This is the right way to do that
$('.slideshow').click(function(){
$('id').cycle('pause');
});
精彩评论