views:

336

answers:

4

I was able to instantiate a working scroller using jQuery Jcarousel however I need it to reverse scroll. For example right now I have:

jQuery(document).ready(function() {

             jQuery('#mycarousel').jcarousel({
            auto: 1,
            vertical: true,
            scroll: 1,
            animation: "slow",
            wrap: 'last',
            initCallback: mycarousel_initCallback
        }); 
        });

What do I need to do to make the items scroll upwards instead of downwards?

Thank You in advance

+1  A: 

Hi Scott,

Reverse autoscrolling is not implemented yet although you can code it quite easily.

This is the autoscrolling function in jCarousel:

/**
 * Starts autoscrolling.
 *
 * @method auto
 * @return undefined
 * @param s {Number} Seconds to periodically autoscroll the content.
 */
    startAuto: function(s) {
        if (s != undefined)
            this.options.auto = s;

        if (this.options.auto == 0)
            return this.stopAuto();

        if (this.timer != null)
            return;

        var self = this;
        this.timer = setTimeout(function() { self.next(); }, this.options.auto * 1000);
    },

(Lines 687 to 706 in jquery.carousel.js )

Changing self.next(); to self.prev() should to the trick (can't test it right now, if you do please post the results).

Good luck :)

XaviEsteve
Thank you so much for the quick response. I specifically changed line # 705 to : this.timer = setTimeout(function() { self.prev(); }, this.options.auto * 1000);Now the scroller does not scroll and I am not getting any errors in Firebug.
jini
Ahhhhhhhh I had to specifically use the 'start' option and set my index manually since it was starting from 1 and had nothing "previous" to go back to. Thanks again!
jini
Cool! Glad it worked Scott :)
XaviEsteve
A: 

Just to add this to XaviEsteve answer (I can't find a place to add comment to his answer anyway).

Once I've changed self.next() to self.prev(), I have to change 'wrap' option to 'both' to make it work for me, like this.

jQuery('#mycarousel').jcarousel({
        auto: 1,
        wrap: 'both',
        vertical: true, 
        scroll: 1,
        start: 30,
        initCallback: mycarousel_initCallback
    });
Phyo Wai Win
A: 

Check my tweak... I rewrote the auto function & introduced two variables instead of auto, auto & reverseauto Now you can have carousels in the oposite direction on the same page...

Explained in detail at my site(download link for .js there)

http://tech.c-dan.com/cweaks.aspx

Demo there too. Click on share/like if you're on facebook.

Thanks

Chidanand Hiremath, C-DAN

Chidanand
A: 

Yes,Great.Thanks so much. It works.I was looking for it so times.But get this from here only.

Debraj Mandal