开发者

Stopping autoslide of a slider programatically

开发者 https://www.devze.com 2023-03-05 22:32 出处:网络
I have made a slider jquery plugin. The slider 开发者_Go百科starts automatically in autoplay, but when the mouse hovers the slider it stops. There\'s a function for this, of course.

I have made a slider jquery plugin. The slider 开发者_Go百科starts automatically in autoplay, but when the mouse hovers the slider it stops. There's a function for this, of course.

My problem comes when i have a movie inside one of the slides. if the movie is playing, i want to stop the autoplay completely even if the mouse isnt hovering the slider.

How can I call the "stop_autoslide" function inside the plugin, from outside it's code?

Thanks.


You could bind a custom event inside your slider-plugin.

$(sliderObject).bind("stop_slide", stop_autoslide);

And then trigger it from anywhere with:

$(".mySlider").trigger("stop_slide");

Depending on how your plugin works you might need .live() instead of bind.

0

精彩评论

暂无评论...
验证码 换一张
取 消