/* * jQuery Infinite Carousel * @author admin@catchmyfame.com - http://www.catchmyfame.com * @version 3.0.2 * @date February 2, 2012 * @category jQuery plugin * @copyright (c) admin@catchmyfame.com (www.catchmyfame.com) * @license CC Attribution-Share Alike 3.0 - http://creativecommons.org/licenses/by-sa/3.0/ */ (function($){ $.fn.extend({ infiniteCarousel: function(options) { var defaults = { transitionSpeed: 800, displayTime: 6000, displayProgressRing: true, progressRingColorOpacity: '0,0,0,.5', progressRingBackgroundOn: true, progressRingBackgroundColorOpacity: '255,255,255,.5', thumbnailType: 'none', // buttons, images, numbers, count, or none easeLeft: 'linear', easeRight: 'linear', imagePath: '/assets/', inView: 1, margin: 0, advance: 1, customClass: null, showControls: true, autoHideCaptions: false, autoPilot: true, prevNextInternal: true, internalThumbnails: false, enableKeyboardNav: true, onSlideStart: function(){}, onSlideEnd: function(){}, onPauseClick: function(){}, onPlayClick: function(){} }; var options = $.extend(defaults, options); return this.each(function() { var o=options; var obj = $(this); var randID = Math.round(Math.random()*100000000); var numItems = $('li', obj).length; // Number of items var captions=[]; // captions array var links=[]; // links array var itemSources=[]; // sources array var vidThumb=[]; // video thumbnails (supplied by the longdesc attribute in the iframe) var widthSource,heightSource; // width and height of each item var nextLeft,nextRight; // pointers to the next array index for moving left and right var clrTimerInterval; // interval handle variable for timer and autoPilot var u,elapsedTime=0; var canvasSupported = "HTMLCanvasElement" in window; $('li',obj).each(function(index){ // populate arrays captions.push( $('p',this).html() ); links.push( $('a',this).attr('href') ); vidThumb.push( $(this).find('iframe').attr('longdesc') ); itemSources.push( $(this).find('img, iframe').attr('src') ); // finds images and youtube and vimeo iframe sources }); // Check for improper values in inview and advance if(o.inView > numItems) o.inView = numItems; // Prevent trying to view more images than given if(o.advance > o.inView) o.advance = o.inView; // Prevent advancing more than inView images at a time // Dimensions should be set explicitly on the items so that we don't have to defer loading code until the images are loaded widthSource = $(this).find('img, iframe').width(); heightSource = $(this).find('img, iframe').height(); // Build carousel container $(obj).replaceWith('