Created
November 6, 2014 20:40
-
-
Save chrisdhanaraj/e8ba1e65b925926332ff to your computer and use it in GitHub Desktop.
Basic Carousel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$( '.carousel' ).cycle({ | |
fx: 'carousel', | |
timeout: 0 | |
}); | |
$('.next').on('click', function() { | |
nextSlide(); | |
}); | |
$('.prev').on('click', function() { | |
prevSlide(); | |
}); | |
function nextSlide() { | |
var currentSlide = $('.carousel').data("cycle.opts").currSlide; | |
$('.carousel').cycle('goto', currentSlide + 4); | |
} | |
function prevSlide() { | |
var currentSlide = $('.carousel').data("cycle.opts").currSlide; | |
$('.carousel').cycle('goto', currentSlide - 4); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment