Lars Hovden
Lars Hovden

Reputation: 333

jquery cycle content with a prev and next buttone

I have a jquery cycle script for my website to continually cycle through content on what's new within our company. Right not I have the transition set to scrollLeft. I would like to add a prev and next button that would scrollRight on prev and scrollLeft on next. I couldn't find any forums that would do quite what I'm looking for. Here is my code.

$('#slider').cycle({
    // choose your transition type, ex: fade, scrollUp, shuffle, etc...
    fx: 'scrollLeft',
    delay: -100,
    prev:   '#prev',
    next:   '#next',  
})

Thanks for the help.

Upvotes: 0

Views: 469

Answers (1)

Matt Stauffer
Matt Stauffer

Reputation: 2742

To get the navigation, you just need to create "prev" and "next" buttons with the IDs of prev and next.

To get the reverse scrolling, you'll want to set your scroll to be scrollHorz and then set the rev option (reverse) to 1. See here: http://jsfiddle.net/mstauffer/g9b7k/

$('#slider').cycle({
    fx:     'scrollHorz',
    delay:  -100,
    prev:   '#prev',
    next:   '#next',
    rev: 1
});​

Upvotes: 2

Related Questions