Skip to content

Instantly share code, notes, and snippets.

@rtgibbons rtgibbons/slider.js
Created Feb 18, 2010

Embed
What would you like to do?
var min = $('#carousel-canvas').width()
var max = $('#carousel-canvas > div').width();
$('#carousel .right-arrow').click(function(event) {
event.preventDefault();
var spot = $('#carousel-canvas').position().left + $('#carousel-canvas').width() - $('#carousel-canvas > div').position().left;
if (spot != max && !($(this).hasClass('animated'))){
var link = $(this);
link.addClass('animated');
$('#carousel-canvas > div').stop(true,true).clearQueue().animate({"left":"-=440px"},400, function() {link.removeClass('animated');});
}
});
$('#carousel .left-arrow').click(function(event) {
event.preventDefault();
var spot = $('#carousel-canvas').position().left + $('#carousel-canvas').width() - $('#carousel-canvas > div').position().left;
if (spot != min && !($(this).hasClass('animated'))) {
var link = $(this);
link.addClass('animated');
$('#carousel-canvas > div').stop(true,true).clearQueue().animate({"left":"-=-440px"},400, function() {link.removeClass('animated');});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.