如何通过外部控件/事件启动/停止jCarousel [英] How to Start/Stop jCarousel by external controls/events
问题描述
对于当前项目,我需要触发 jCarousel插件的启动/停止事件.
For a current project i need to trigger the Start/Stop Event of the jCarousel Plugin.
carousel.stopAuto();
carousel.startAuto();
我并不是说JavaScript会沉迷于自己解决问题.简短的解释是我要做什么:
I'm not that JavaScript addicted to solve the problem myself. A short explaination what i'm trying to do:
该轮播是一款精美的产品滑块,并且已经可以按我的预期工作了.但是重点是产品说明应该作为工具提示可用.因此,如果显示工具提示,我必须停止旋转木马,并在工具提示关闭后重新启动它.仅供参考:工具提示插件是Cluetip.有人对我有什么建议吗?
The carousel is a fancy product slider and works already as i expected. But the point is the product-description should be available as a tooltip. So i have to stop the carousel if an tooltip is shown and to restart it after the tooltip is closed. FYI: The tooltip Plugin is Cluetip. Does anyone have any suggestions for me?
推荐答案
找到了解决方案.使用以下函数作为轮播设置的初始化回调.
Found a solution. Use the following function as init callback for your carousel setup.
function initCarousel (carousel) {
jQuery('#cluetip').live('mouseover mouseout', function(event) {
// Disable default action
event.preventDefault();
// Stop carousel at mouseover
if (event.type == 'mouseover') {
carousel.stopAuto();
};
// Restart carousel at mouseout
if (event.type == 'mouseout') {
carousel.startAuto()
};
});
};
这篇关于如何通过外部控件/事件启动/停止jCarousel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!