Skip to content

Instantly share code, notes, and snippets.

@chrisdhanaraj
Created November 6, 2014 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisdhanaraj/e8ba1e65b925926332ff to your computer and use it in GitHub Desktop.
Save chrisdhanaraj/e8ba1e65b925926332ff to your computer and use it in GitHub Desktop.
Basic Carousel
$( '.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