autoslide jQuery jCarousel Lite not working

冷暖自知 提交于 2019-12-01 10:47:31

Apparently, jCarousel Lite does not offer the pause option.

There is a discussion here about making a modification to jCarousel Lite to add a pause option.

According to comments on the jCarousel Lite website, the modifications to the un-minified jcarousellite.js file are as follows:

Add this to the list of options (under the o = $.extend({ line).

pause: false

Find this section:

if(o.auto)
        setInterval(function() {
            go(curr+o.scroll);
        }, o.auto+o.speed);

And replace it with this:

if(o.auto)
    aktiv = setInterval(function() {
        go(curr+o.scroll);
    }, o.auto+o.speed);

if(o.pause)
    div.mouseover(function() {
        clearInterval(aktiv);
    });
    div.mouseout(function() {
        aktiv = setInterval(function() {
            go(curr+o.scroll);
        }, o.auto+o.speed);
    });

Within your jCarouselLite() parameters, include it like this...

pause: true

If you are on a page,

and if two or more runs jCarouselLite,

variables o need to explicitly add the extension object in aktiv.

o = $.extend({
    aktiv: null,
    pause: false


and aktiv changes o.aktiv

before code: aktiv
after code: o.aktiv

if(o.auto)
    o.aktiv = setInterval(function() {
        go(curr+o.scroll);
    }, o.auto+o.speed);

if(o.pause) {
    div.mouseover(function() {
        clearInterval(o.aktiv);
    });
    div.mouseout(function() {
        o.aktiv = setInterval(function() {
            go(curr+o.scroll);
        }, o.auto+o.speed);
    });
}


finished :D

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!