/* * loopedCarousel 0.5 - jQuery plugin * written by Nathan Searles, based on loopedSlider (http://github.com/nathansearles/loopedSlider) * http://github.com/nathansearles/loopedCarousel * * Copyright (c) 2009 Nathan Searles (http://nathansearles.com/) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * Built for jQuery library * http://jquery.com * */ /* * markup example for $("#loopedCarousel").loopedCarousel(); * *
*
*
*
1
*
2
*
3
*
4
*
5
*
6
*
7
*
8
*
9
*
10
*
11
*
12
*
13
*
14
*
15
*
*
* * *
* */ (function($) { $.fn.loopedCarousel = function(options) { var defaults = { container: '.carousel-container', slides: '.slides', pagination: '.pagination', autoStart: 0, // Set to positive number for auto interval and interval time slidespeed: 800, // Speed of slide animation fadespeed: 300, // Speed of fade animation items: 4, // Items show padding: 16, // Padding between items showPagination: false, // Shows pagination links vertical: false }; this.each(function() { var obj = $(this); var o = $.extend(defaults, options); var i = o.items; var m = 0; var t = 1; var s = $(o.slides,obj).children().size(); var w = $(o.slides,obj).children().outerWidth()+o.padding; var h = $(o.slides,obj).children().outerHeight()+o.padding; var c = Math.ceil($(o.slides,obj).children().size()/i); var pd = o.padding/2; var p = 0; var u = false; var n = 0; var pt = 0; var os = i*c-s; var params = {}; if (o.vertical===true) { w = h; } if(o.showPagination){ var buttons = s/i; $(obj).append('