Skip to content

Instantly share code, notes, and snippets.

@tamagokun
Created February 24, 2015 15:01
Show Gist options
  • Save tamagokun/e2dd203f35bed0cb5517 to your computer and use it in GitHub Desktop.
Save tamagokun/e2dd203f35bed0cb5517 to your computer and use it in GitHub Desktop.
dave's slides
var interList;
var runSlides = function() {
interList = setInterval(function() {
$(".jcarousel li").fadeOut(1000).hide();
$(".jcarousel li.front").removeClass("front").next().fadeIn(1000).addClass("front");
$(".jcarousel li:first").appendTo(".jcarousel ul");
}, 5000);
}
$(document).ready(function() {
$(".jcarousel li").first().addClass("front");
$(".jcarousel-control-next").click(function () {
clearInterval(interList);
$(".jcarousel li").fadeOut(1000).hide();
$(".jcarousel li.front").removeClass("front").next().fadeIn(1000).addClass("front");
$(".jcarousel li:first").appendTo(".jcarousel ul");
runSlides();
});
$(".jcarousel-control-prev").click(function () {
clearInterval(interList);
$(".jcarousel li:last").prependTo(".jcarousel ul");
$(".jcarousel li").fadeOut(1000).hide();
$(".jcarousel li.front").removeClass("front").prev().fadeIn(1000).addClass("front");
runSlides();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment