├── README.md ├── bower.json ├── changelog.txt ├── helper-plugins ├── jquery.ba-throttle-debounce.min.js ├── jquery.mousewheel.min.js ├── jquery.touchSwipe.min.js └── jquery.transit.min.js ├── index.html ├── jquery.carouFredSel-6.2.1-packed.js ├── jquery.carouFredSel-6.2.1.js └── license.txt /README.md: -------------------------------------------------------------------------------- 1 | carouFredSel 2 | ============ 3 | 4 | A circular, responsive carousel plugin built using the jQuery. See http://caroufredsel.dev7studios.com 5 | 6 | Docs: http://docs.dev7studios.com/category/11-caroufredsel 7 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gilbitron/carouFredSel", 3 | "version": "6.2.1", 4 | "main": "jquery.carouFredSel-6.2.1.js", 5 | "description": "A circular, responsive carousel plugin built using the jQuery.", 6 | "license": "MIT", 7 | "ignore": [ 8 | ".jshintrc", 9 | "**/*.txt" 10 | ], 11 | "dependencies": { 12 | "jquery": ">=1.7 <2.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- 1 | version 6.2.x 2 | Plugin is now capable of using CSS-transitions (instead of javascript animations) powered by the jQuery.transit-plugin. 3 | Optionally use the existing wrapper element a the carousel-wrapper. 4 | Improved resetting to pre-init state after triggering the "destroy"-custom event. 5 | Removed the use of public methods. 6 | 7 | version 6.1.x 8 | Added support for using the jQuery.throttle and jQuery.debounce plugins. 9 | Small bugfixes. 10 | Added z-index to cloned carousels for fx crossfade and (un)cover. 11 | 12 | version 6.0.x 13 | Added new scrolling effects "cover-fade" and "uncover-fade". 14 | Replaced support for the touchwipe-plugin with the touchSwipe-plugin. 15 | Added option to swipe using the mouse (drag). 16 | Changed the scroll.swipe option to a new scroll-object. 17 | Changed scroll.mousewheel options to a new scroll-object. 18 | Added auto.progress.bar, auto.progress.interval and auto.progress.updater options for progressbar behavior. 19 | Renamed auto.onPauseStart, auto.onPausePause and auto.onPauseEnd to auto.onTimeoutStart, auto.onTimeoutPause and auto.onTimeoutEnd. 20 | Renamed auto.pauseDuration to auto.timeoutDuration. 21 | Added option pagination.deviation to deviate selected pager-bullet. 22 | The 2nd plugin parameter can be true as a shortcut for { debug: true }. 23 | Added parameter direction to the conditions and onEnd-callback function. 24 | The onBefore, onAfter and onCreate-callback functions now receive only one parameter: a map of all data. 25 | Added scroll.direction to the parameter for the onBefore and onAfter-callback functions. 26 | Added scroll.items to the parameter for the onBefore and onAfter-callback functions. 27 | Added items.skipped to the parameter for the onBefore and onAfter-callback functions. 28 | The scroll-object parameter in the prev and next-custom events extend and not override the configuration scroll-object. 29 | Added parameter queue to the prev and next-custom events. 30 | Added object $.fn.carouFredSel.cookie with get, set and remove functions to manage cookies. 31 | Removed item argument from anchorBuilder-callback function, now this refers to the current item. 32 | Fixed non-circular bug on responsive carousels. 33 | Fixed variable item-sizes bug in alternative effects. 34 | Fixed double duration time in fade-effect. 35 | Fixed destroying responsive carousel bug. 36 | Fixed bug with negative margin when scrolling backward. 37 | 38 | version 5.6.x 39 | Fixed responsive bug in IE. 40 | Fixed small bugs. 41 | 42 | version 5.5.x 43 | Enabled creating responsive carousels. 44 | Added support for dynamic sizes (e.g. "100%"). 45 | Added pauseOnResize option. 46 | Added pauseOnEvent option. 47 | Fixed small bugs. 48 | 49 | version 5.4.x 50 | Added slice-custom event. 51 | Addes easing funcitons quadratic, cubic and elastic. 52 | 53 | version 5.3.x 54 | Added updateSizes-custom event. 55 | Addes items.filter option to specify the elements to handle as items (and ignore all other elements). 56 | Added option to use a fixed pagination. 57 | 58 | version 5.2.x 59 | Added auto.button and auto.event options. 60 | Added classnames.paused and classnames.stopped to the second configuration object. 61 | Improved showing more items than would fit. 62 | items.visible can take a function that returns a value. 63 | Added array option for items.start 64 | Added scrolling a dynamic number of items. 65 | Fixed bug with negative padding. 66 | Added option to specify the classnames for navigational buttons and anchors. 67 | 68 | version 5.1.x 69 | Added "page" as a value for scroll.items. 70 | Added min and max as an option for items.visible. 71 | Improved scrolling a variable number of visible items. 72 | Added option to set the namespace and a prefix for the custom events. 73 | Changed behavior for "+1", "-1", "odd", "odd+, "even" and "even+" for items.visible. 74 | Added showing a dynamic number of items. 75 | Added onAfter paramter for the slideTo-custom event. 76 | Added prevPage-, nextPage- and slideToPage-custom events. 77 | 78 | version 5.0.x 79 | Added option to specify items per page in pagination. 80 | Added option to resume pause in custom event. 81 | Rewrote large sections of the code. 82 | Changed return value of the isPaused-custom event. 83 | Added isStopped-custom event. 84 | Added isScrolling-custom event. 85 | Added option to immediately pause or stop a carousel 86 | Added finish and resume-custom events. 87 | Added onBefore and onAfter-custom events. 88 | Added option to start at the position stored in a cookie. 89 | Improved onPauseStart, onPausePause and onPauseEnd timing. 90 | Added second configuration-object for plugin options. 91 | Moved dedug-option to second configuration-object. 92 | 93 | version 4.5.x 94 | Added event and wipe options to the scrolling configuration. 95 | Fixed bug in non-circular carousels with a viriable number of visible items. 96 | 97 | version 4.4.x 98 | Added "+1", "-1", "odd", "odd+, "even" and "even+" as a value for items.visible. 99 | Added queue option and event. 100 | Added synchronise option and event. 101 | Added fx "directscroll". 102 | Added direction paramter for the slideTo-custom event. 103 | Enabled inserting items at the end of the list in the original item order. 104 | button and container options can take a function that returns a value. 105 | Fixed bug with fx "cover" and "uncover" with variable sizes. 106 | Fixed bug with same buttons on multiple carousels. 107 | 108 | version 4.3.x 109 | Replaced global pause with stop-custom event. 110 | Increased performance. 111 | Enabled using the return value when calling the triggerHandler-method. 112 | Fixed nested carousel bug. 113 | Added debug option for debugging. 114 | Added currentPage and currentVisible as custom events. 115 | Added align "left" (or "top"), "right" (or "bottom") and "center". 116 | The configuration-custom event now supports a key/value object as configuration. 117 | Optional onAfter-callback function as parameter in the prev- and next-custom events. 118 | 119 | version 4.2.x 120 | Added onCreate callback-function. 121 | Improved parameters in callback-functions. 122 | Improvements made to destroy event. 123 | Added fx "fade", "crossfade", "cover" and "uncover". 124 | Added option to put items back in original order when destroying a carousel. 125 | 126 | version 4.1.x 127 | Updated current page calculation on pagination. 128 | Fixed bug with auto-complemented values when re-setting options. 129 | Added firstItem as a second parameter in the anchorBuilder function. 130 | Scope (this) in callback-function now refers to the carousels HTML-element. 131 | Carousel no longer scroll if it isn't visible (:hidden). 132 | Added configuration and currentPosition as custom events. 133 | Added onPauseStart, onPauseEnd and onPausePause callback-functions for scrolling automatically. 134 | 135 | version 4.0.x 136 | Plugin automatically complements undefined values for sizes, padding and visible items, depending on other options. For example: if the number of visible items is undefined, it will be calculated by deviding the width by the item width. 137 | Better support for a variable number of visible items with variable sizes. 138 | Added padding: "auto" to automatically center the items inside the carousel. 139 | Added items.start: "random". 140 | Added linkAnchors and destroy as custom events. 141 | Wrapper will inherit margins from carousel-element. 142 | Added conditions callback-functions. 143 | 144 | version 3.2.x 145 | prev and next events no longer scroll a globally paused carousel. 146 | Added auto as a value for the height/width option. 147 | Added current_position public method. 148 | Blocked double created carousels (first created will be destroyed). 149 | 150 | version 3.1.x 151 | Added onEnd callback-functions. 152 | 153 | version 3.0.x 154 | Added support for a Variable Number Of Visible Items With Variable Sizes. 155 | 156 | version 2.6.x 157 | Removed support for scrollTo (conflicted with prototype). 158 | Added preventDefault on keyPresses. 159 | 160 | version 2.5.x 161 | Added option to globally pause and play. 162 | Integrated the jQuery.mousewheel-plugin. 163 | Added the link_anchors public method. 164 | Added option to resume the pauseOnHover onMouseOut as an alternative to restart it. 165 | 166 | version 2.4.x 167 | Added shorthand notation for the items and scroll options. 168 | Added optional padding to the wrapper-div. 169 | Made firing the plugin case-insensitive. 170 | Added the items.minimal and items.start options. 171 | Changed the parameters for the callback-functions onBefore and onAfter. 172 | Changed the name for the custom event scrollTo in to slideTo. 173 | 174 | version 2.3.x 175 | Added the option to create non-circular carousels. 176 | Added the option to create non-infinite carousels. 177 | Changed the parameters for the custom events scrollTo, insertItem en removeItem. 178 | 179 | version 2.2.x 180 | Added pixel-based speed calculation. 181 | Added the public methods configuration and destroy. 182 | Changed the parameters for the callback-functions onBefore and onAfter. 183 | 184 | version 2.1.x 185 | Added support for variable item sizes. 186 | Added the option to set a fixed width and height for the carousel. 187 | Changed the option visibleItems in to items.visible. 188 | 189 | version 2.0.x 190 | Integrated the jQuery.nap-plugin. 191 | Added item-based speed calculation. 192 | Changed the option autoPlay in to auto.play. 193 | Added the possibility to create a carousel from any HTML element. 194 | -------------------------------------------------------------------------------- /helper-plugins/jquery.ba-throttle-debounce.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery throttle / debounce - v1.1 - 3/7/2010 3 | * http://benalman.com/projects/jquery-throttle-debounce-plugin/ 4 | * 5 | * Copyright (c) 2010 "Cowboy" Ben Alman 6 | * Dual licensed under the MIT and GPL licenses. 7 | * http://benalman.com/about/license/ 8 | */ 9 | (function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); -------------------------------------------------------------------------------- /helper-plugins/jquery.mousewheel.min.js: -------------------------------------------------------------------------------- 1 | /*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) 2 | * Licensed under the MIT License (LICENSE.txt). 3 | * 4 | * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 5 | * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 6 | * Thanks to: Seamus Leahy for adding deltaX and deltaY 7 | * 8 | * Version: 3.0.6 9 | * 10 | * Requires: 1.2.2+ 11 | */ 12 | (function(a){function d(b){var c=b||window.event,d=[].slice.call(arguments,1),e=0,f=!0,g=0,h=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/120),c.detail&&(e=-c.detail/3),h=e,c.axis!==undefined&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),c.wheelDeltaY!==undefined&&(h=c.wheelDeltaY/120),c.wheelDeltaX!==undefined&&(g=-1*c.wheelDeltaX/120),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)}var b=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],d,!1);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],d,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery) 13 | -------------------------------------------------------------------------------- /helper-plugins/jquery.touchSwipe.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * touchSwipe - jQuery Plugin 3 | * https://github.com/mattbryson/TouchSwipe-Jquery-Plugin 4 | * http://labs.skinkers.com/touchSwipe/ 5 | * http://plugins.jquery.com/project/touchSwipe 6 | * 7 | * Copyright (c) 2010 Matt Bryson (www.skinkers.com) 8 | * Dual licensed under the MIT or GPL Version 2 licenses. 9 | * 10 | * $version: 1.3.3 11 | */ 12 | 13 | (function(g){function P(c){if(c&&void 0===c.allowPageScroll&&(void 0!==c.swipe||void 0!==c.swipeStatus))c.allowPageScroll=G;c||(c={});c=g.extend({},g.fn.swipe.defaults,c);return this.each(function(){var b=g(this),f=b.data(w);f||(f=new W(this,c),b.data(w,f))})}function W(c,b){var f,p,r,s;function H(a){var a=a.originalEvent,c,Q=n?a.touches[0]:a;d=R;n?h=a.touches.length:a.preventDefault();i=0;j=null;k=0;!n||h===b.fingers||b.fingers===x?(r=f=Q.pageX,s=p=Q.pageY,y=(new Date).getTime(),b.swipeStatus&&(c= l(a,d))):t(a);if(!1===c)return d=m,l(a,d),c;e.bind(I,J);e.bind(K,L)}function J(a){a=a.originalEvent;if(!(d===q||d===m)){var c,e=n?a.touches[0]:a;f=e.pageX;p=e.pageY;u=(new Date).getTime();j=S();n&&(h=a.touches.length);d=z;var e=a,g=j;if(b.allowPageScroll===G)e.preventDefault();else{var o=b.allowPageScroll===T;switch(g){case v:(b.swipeLeft&&o||!o&&b.allowPageScroll!=M)&&e.preventDefault();break;case A:(b.swipeRight&&o||!o&&b.allowPageScroll!=M)&&e.preventDefault();break;case B:(b.swipeUp&&o||!o&&b.allowPageScroll!= N)&&e.preventDefault();break;case C:(b.swipeDown&&o||!o&&b.allowPageScroll!=N)&&e.preventDefault()}}h===b.fingers||b.fingers===x||!n?(i=U(),k=u-y,b.swipeStatus&&(c=l(a,d,j,i,k)),b.triggerOnTouchEnd||(e=!(b.maxTimeThreshold?!(k>=b.maxTimeThreshold):1),!0===D()?(d=q,c=l(a,d)):e&&(d=m,l(a,d)))):(d=m,l(a,d));!1===c&&(d=m,l(a,d))}}function L(a){a=a.originalEvent;a.preventDefault();u=(new Date).getTime();i=U();j=S();k=u-y;if(b.triggerOnTouchEnd||!1===b.triggerOnTouchEnd&&d===z)if(d=q,(h===b.fingers||b.fingers=== x||!n)&&0!==f){var c=!(b.maxTimeThreshold?!(k>=b.maxTimeThreshold):1);if((!0===D()||null===D())&&!c)l(a,d);else if(c||!1===D())d=m,l(a,d)}else d=m,l(a,d);else d===z&&(d=m,l(a,d));e.unbind(I,J,!1);e.unbind(K,L,!1)}function t(){y=u=p=f=s=r=h=0}function l(a,c){var d=void 0;b.swipeStatus&&(d=b.swipeStatus.call(e,a,c,j||null,i||0,k||0,h));if(c===m&&b.click&&(1===h||!n)&&(isNaN(i)||0===i))d=b.click.call(e,a,a.target);if(c==q)switch(b.swipe&&(d=b.swipe.call(e,a,j,i,k,h)),j){case v:b.swipeLeft&&(d=b.swipeLeft.call(e, a,j,i,k,h));break;case A:b.swipeRight&&(d=b.swipeRight.call(e,a,j,i,k,h));break;case B:b.swipeUp&&(d=b.swipeUp.call(e,a,j,i,k,h));break;case C:b.swipeDown&&(d=b.swipeDown.call(e,a,j,i,k,h))}(c===m||c===q)&&t(a);return d}function D(){return null!==b.threshold?i>=b.threshold:null}function U(){return Math.round(Math.sqrt(Math.pow(f-r,2)+Math.pow(p-s,2)))}function S(){var a;a=Math.atan2(p-s,r-f);a=Math.round(180*a/Math.PI);0>a&&(a=360-Math.abs(a));return 45>=a&&0<=a?v:360>=a&&315<=a?v:135<=a&&225>=a? A:45a?C:B}function V(){e.unbind(E,H);e.unbind(F,t);e.unbind(I,J);e.unbind(K,L)}var O=n||!b.fallbackToMouseEvents,E=O?"touchstart":"mousedown",I=O?"touchmove":"mousemove",K=O?"touchend":"mouseup",F="touchcancel",i=0,j=null,k=0,e=g(c),d="start",h=0,y=p=f=s=r=0,u=0;try{e.bind(E,H),e.bind(F,t)}catch(P){g.error("events not supported "+E+","+F+" on jQuery.swipe")}this.enable=function(){e.bind(E,H);e.bind(F,t);return e};this.disable=function(){V();return e};this.destroy=function(){V();e.data(w,null); return e}}var v="left",A="right",B="up",C="down",G="none",T="auto",M="horizontal",N="vertical",x="all",R="start",z="move",q="end",m="cancel",n="ontouchstart"in window,w="TouchSwipe";g.fn.swipe=function(c){var b=g(this),f=b.data(w);if(f&&"string"===typeof c){if(f[c])return f[c].apply(this,Array.prototype.slice.call(arguments,1));g.error("Method "+c+" does not exist on jQuery.swipe")}else if(!f&&("object"===typeof c||!c))return P.apply(this,arguments);return b};g.fn.swipe.defaults={fingers:1,threshold:75, maxTimeThreshold:null,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,click:null,triggerOnTouchEnd:!0,allowPageScroll:"auto",fallbackToMouseEvents:!0};g.fn.swipe.phases={PHASE_START:R,PHASE_MOVE:z,PHASE_END:q,PHASE_CANCEL:m};g.fn.swipe.directions={LEFT:v,RIGHT:A,UP:B,DOWN:C};g.fn.swipe.pageScroll={NONE:G,HORIZONTAL:M,VERTICAL:N,AUTO:T};g.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,ALL:x}})(jQuery); -------------------------------------------------------------------------------- /helper-plugins/jquery.transit.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Transit - CSS3 transitions and transformations 3 | * (c) 2011-2012 Rico Sta. Cruz 4 | * MIT Licensed. 5 | * 6 | * http://ricostacruz.com/jquery.transit 7 | * http://github.com/rstacruz/jquery.transit 8 | */ 9 | (function(d){function m(a){if(a in j.style)return a;var b=["Moz","Webkit","O","ms"],c=a.charAt(0).toUpperCase()+a.substr(1);if(a in j.style)return a;for(a=0;ad.fn.jquery&&(d.cssHooks.transformOrigin={get:function(a){return a.style[e.transformOrigin]},set:function(a,b){a.style[e.transformOrigin]=b}},d.cssHooks.transition={get:function(a){return a.style[e.transition]},set:function(a,b){a.style[e.transition]=b}});f("scale"); 16 | f("translate");f("rotate");f("rotateX");f("rotateY");f("rotate3d");f("perspective");f("skewX");f("skewY");f("x",!0);f("y",!0);l.prototype={setFromString:function(a,b){var c="string"===typeof b?b.split(","):b.constructor===Array?b:[b];c.unshift(a);l.prototype.set.apply(this,c)},set:function(a){var b=Array.prototype.slice.apply(arguments,[1]);this.setter[a]?this.setter[a].apply(this,b):this[a]=b.join(",")},get:function(a){return this.getter[a]?this.getter[a].apply(this):this[a]||0},setter:{rotate:function(a){this.rotate= 17 | g(a,"deg")},rotateX:function(a){this.rotateX=g(a,"deg")},rotateY:function(a){this.rotateY=g(a,"deg")},scale:function(a,b){void 0===b&&(b=a);this.scale=a+","+b},skewX:function(a){this.skewX=g(a,"deg")},skewY:function(a){this.skewY=g(a,"deg")},perspective:function(a){this.perspective=g(a,"px")},x:function(a){this.set("translate",a,null)},y:function(a){this.set("translate",null,a)},translate:function(a,b){void 0===this._translateX&&(this._translateX=0);void 0===this._translateY&&(this._translateY=0); 18 | null!==a&&void 0!==a&&(this._translateX=g(a,"px"));null!==b&&void 0!==b&&(this._translateY=g(b,"px"));this.translate=this._translateX+","+this._translateY}},getter:{x:function(){return this._translateX||0},y:function(){return this._translateY||0},scale:function(){var a=(this.scale||"1,1").split(",");a[0]&&(a[0]=parseFloat(a[0]));a[1]&&(a[1]=parseFloat(a[1]));return a[0]===a[1]?a[0]:a},rotate3d:function(){for(var a=(this.rotate3d||"0,0,0,0deg").split(","),b=0;3>=b;++b)a[b]&&(a[b]=parseFloat(a[b])); 19 | a[3]&&(a[3]=g(a[3],"deg"));return a}},parse:function(a){var b=this;a.replace(/([a-zA-Z0-9]+)\((.*?)\)/g,function(a,d,e){b.setFromString(d,e)})},toString:function(a){var b=[],c;for(c in this)if(this.hasOwnProperty(c)&&(e.transform3d||!("rotateX"===c||"rotateY"===c||"perspective"===c||"transformOrigin"===c)))"_"!==c[0]&&(a&&"scale"===c?b.push(c+"3d("+this[c]+",1)"):a&&"translate"===c?b.push(c+"3d("+this[c]+",0)"):b.push(c+"("+this[c]+")"));return b.join(" ")}};d.fn.transition=d.fn.transit=function(a, 20 | b,c,f){var h=this,g=0,j=!0;"function"===typeof b&&(f=b,b=void 0);"function"===typeof c&&(f=c,c=void 0);"undefined"!==typeof a.easing&&(c=a.easing,delete a.easing);"undefined"!==typeof a.duration&&(b=a.duration,delete a.duration);"undefined"!==typeof a.complete&&(f=a.complete,delete a.complete);"undefined"!==typeof a.queue&&(j=a.queue,delete a.queue);"undefined"!==typeof a.delay&&(g=a.delay,delete a.delay);"undefined"===typeof b&&(b=d.fx.speeds._default);"undefined"===typeof c&&(c=d.cssEase._default); 21 | b=n(b);var l=q(a,b,c,g),k=d.transit.enabled&&e.transition?parseInt(b,10)+parseInt(g,10):0;if(0===k)return b=j,c=function(b){h.css(a);f&&f.apply(h);b&&b()},!0===b?h.queue(c):b?h.queue(b,c):c(),h;var m={};b=j;c=function(b){this.offsetWidth;var c=!1,g=function(){c&&h.unbind(p,g);0 2 | 3 | 4 | 5 | 6 | 7 | carouFredSel: a circular, responsive jQuery carousel 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 81 | 82 | 173 | 174 | 175 | 176 |
177 |

carouFredSel

178 |

This is a demo page, for more examples, the complete documentation, tips & tricks, a support-forum and even a configuration robot, visit caroufredsel.dev7studios.com

179 |
180 | 181 |
182 |
183 | 184 | 185 |

Basic carousel.

186 | 204 |
205 | 206 | 207 |

Basic carousel + timer, using CSS-transitions.

208 | 227 |
228 | 229 | 230 |

Carousel scrolled by user interaction.
231 | (prev-button, next-button, pagination, mousewheel and swipe)

232 | 253 |
254 | 255 | 256 |

Carousel with a variable number of visible items with variable sizes.

257 | 277 |
278 |
279 | 280 | 281 |

Responsive layout example resizing the items (resize your browser).

282 | 300 |
301 | 302 | 303 |

Responsive layout example centering the items (resize your browser).

304 | 322 |
323 | 324 | 325 |
326 |
327 | 328 | -------------------------------------------------------------------------------- /jquery.carouFredSel-6.2.1-packed.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery carouFredSel 6.2.1 3 | * Demo's and documentation: 4 | * caroufredsel.dev7studios.com 5 | * 6 | * Copyright (c) 2013 Fred Heusschen 7 | * www.frebsite.nl 8 | * 9 | * Dual licensed under the MIT and GPL licenses. 10 | * http://en.wikipedia.org/wiki/MIT_License 11 | * http://en.wikipedia.org/wiki/GNU_General_Public_License 12 | */ 13 | 14 | 15 | (function($){function sc_setScroll(a,b,c){return"transition"==c.transition&&"swing"==b&&(b="ease"),{anims:[],duration:a,orgDuration:a,easing:b,startTime:getTime()}}function sc_startScroll(a,b){for(var c=0,d=a.anims.length;d>c;c++){var e=a.anims[c];e&&e[0][b.transition](e[1],a.duration,a.easing,e[2])}}function sc_stopScroll(a,b){is_boolean(b)||(b=!0),is_object(a.pre)&&sc_stopScroll(a.pre,b);for(var c=0,d=a.anims.length;d>c;c++){var e=a.anims[c];e[0].stop(!0),b&&(e[0].css(e[1]),is_function(e[2])&&e[2]())}is_object(a.post)&&sc_stopScroll(a.post,b)}function sc_afterScroll(a,b,c){switch(b&&b.remove(),c.fx){case"fade":case"crossfade":case"cover-fade":case"uncover-fade":a.css("opacity",1),a.css("filter","")}}function sc_fireCallbacks(a,b,c,d,e){if(b[c]&&b[c].call(a,d),e[c].length)for(var f=0,g=e[c].length;g>f;f++)e[c][f].call(a,d);return[]}function sc_fireQueue(a,b,c){return b.length&&(a.trigger(cf_e(b[0][0],c),b[0][1]),b.shift()),b}function sc_hideHiddenItems(a){a.each(function(){var a=$(this);a.data("_cfs_isHidden",a.is(":hidden")).hide()})}function sc_showHiddenItems(a){a&&a.each(function(){var a=$(this);a.data("_cfs_isHidden")||a.show()})}function sc_clearTimers(a){return a.auto&&clearTimeout(a.auto),a.progress&&clearInterval(a.progress),a}function sc_mapCallbackArguments(a,b,c,d,e,f,g){return{width:g.width,height:g.height,items:{old:a,skipped:b,visible:c},scroll:{items:d,direction:e,duration:f}}}function sc_getDuration(a,b,c,d){var e=a.duration;return"none"==a.fx?0:("auto"==e?e=b.scroll.duration/b.scroll.items*c:10>e&&(e=d/e),1>e?0:("fade"==a.fx&&(e/=2),Math.round(e)))}function nv_showNavi(a,b,c){var d=is_number(a.items.minimum)?a.items.minimum:a.items.visible+1;if("show"==b||"hide"==b)var e=b;else if(d>b){debug(c,"Not enough items ("+b+" total, "+d+" needed): Hiding navigation.");var e="hide"}else var e="show";var f="show"==e?"removeClass":"addClass",g=cf_c("hidden",c);a.auto.button&&a.auto.button[e]()[f](g),a.prev.button&&a.prev.button[e]()[f](g),a.next.button&&a.next.button[e]()[f](g),a.pagination.container&&a.pagination.container[e]()[f](g)}function nv_enableNavi(a,b,c){if(!a.circular&&!a.infinite){var d="removeClass"==b||"addClass"==b?b:!1,e=cf_c("disabled",c);if(a.auto.button&&d&&a.auto.button[d](e),a.prev.button){var f=d||0==b?"addClass":"removeClass";a.prev.button[f](e)}if(a.next.button){var f=d||b==a.items.visible?"addClass":"removeClass";a.next.button[f](e)}}}function go_getObject(a,b){return is_function(b)?b=b.call(a):is_undefined(b)&&(b={}),b}function go_getItemsObject(a,b){return b=go_getObject(a,b),is_number(b)?b={visible:b}:"variable"==b?b={visible:b,width:b,height:b}:is_object(b)||(b={}),b}function go_getScrollObject(a,b){return b=go_getObject(a,b),is_number(b)?b=50>=b?{items:b}:{duration:b}:is_string(b)?b={easing:b}:is_object(b)||(b={}),b}function go_getNaviObject(a,b){if(b=go_getObject(a,b),is_string(b)){var c=cf_getKeyCode(b);b=-1==c?$(b):c}return b}function go_getAutoObject(a,b){return b=go_getNaviObject(a,b),is_jquery(b)?b={button:b}:is_boolean(b)?b={play:b}:is_number(b)&&(b={timeoutDuration:b}),b.progress&&(is_string(b.progress)||is_jquery(b.progress))&&(b.progress={bar:b.progress}),b}function go_complementAutoObject(a,b){return is_function(b.button)&&(b.button=b.button.call(a)),is_string(b.button)&&(b.button=$(b.button)),is_boolean(b.play)||(b.play=!0),is_number(b.delay)||(b.delay=0),is_undefined(b.pauseOnEvent)&&(b.pauseOnEvent=!0),is_boolean(b.pauseOnResize)||(b.pauseOnResize=!0),is_number(b.timeoutDuration)||(b.timeoutDuration=10>b.duration?2500:5*b.duration),b.progress&&(is_function(b.progress.bar)&&(b.progress.bar=b.progress.bar.call(a)),is_string(b.progress.bar)&&(b.progress.bar=$(b.progress.bar)),b.progress.bar?(is_function(b.progress.updater)||(b.progress.updater=$.fn.carouFredSel.progressbarUpdater),is_number(b.progress.interval)||(b.progress.interval=50)):b.progress=!1),b}function go_getPrevNextObject(a,b){return b=go_getNaviObject(a,b),is_jquery(b)?b={button:b}:is_number(b)&&(b={key:b}),b}function go_complementPrevNextObject(a,b){return is_function(b.button)&&(b.button=b.button.call(a)),is_string(b.button)&&(b.button=$(b.button)),is_string(b.key)&&(b.key=cf_getKeyCode(b.key)),b}function go_getPaginationObject(a,b){return b=go_getNaviObject(a,b),is_jquery(b)?b={container:b}:is_boolean(b)&&(b={keys:b}),b}function go_complementPaginationObject(a,b){return is_function(b.container)&&(b.container=b.container.call(a)),is_string(b.container)&&(b.container=$(b.container)),is_number(b.items)||(b.items=!1),is_boolean(b.keys)||(b.keys=!1),is_function(b.anchorBuilder)||is_false(b.anchorBuilder)||(b.anchorBuilder=$.fn.carouFredSel.pageAnchorBuilder),is_number(b.deviation)||(b.deviation=0),b}function go_getSwipeObject(a,b){return is_function(b)&&(b=b.call(a)),is_undefined(b)&&(b={onTouch:!1}),is_true(b)?b={onTouch:b}:is_number(b)&&(b={items:b}),b}function go_complementSwipeObject(a,b){return is_boolean(b.onTouch)||(b.onTouch=!0),is_boolean(b.onMouse)||(b.onMouse=!1),is_object(b.options)||(b.options={}),is_boolean(b.options.triggerOnTouchEnd)||(b.options.triggerOnTouchEnd=!1),b}function go_getMousewheelObject(a,b){return is_function(b)&&(b=b.call(a)),is_true(b)?b={}:is_number(b)?b={items:b}:is_undefined(b)&&(b=!1),b}function go_complementMousewheelObject(a,b){return b}function gn_getItemIndex(a,b,c,d,e){if(is_string(a)&&(a=$(a,e)),is_object(a)&&(a=$(a,e)),is_jquery(a)?(a=e.children().index(a),is_boolean(c)||(c=!1)):is_boolean(c)||(c=!0),is_number(a)||(a=0),is_number(b)||(b=0),c&&(a+=d.first),a+=b,d.total>0){for(;a>=d.total;)a-=d.total;for(;0>a;)a+=d.total}return a}function gn_getVisibleItemsPrev(a,b,c){for(var d=0,e=0,f=c;f>=0;f--){var g=a.eq(f);if(d+=g.is(":visible")?g[b.d.outerWidth](!0):0,d>b.maxDimension)return e;0==f&&(f=a.length),e++}}function gn_getVisibleItemsPrevFilter(a,b,c){return gn_getItemsPrevFilter(a,b.items.filter,b.items.visibleConf.org,c)}function gn_getScrollItemsPrevFilter(a,b,c,d){return gn_getItemsPrevFilter(a,b.items.filter,d,c)}function gn_getItemsPrevFilter(a,b,c,d){for(var e=0,f=0,g=d,h=a.length;g>=0;g--){if(f++,f==h)return f;var i=a.eq(g);if(i.is(b)&&(e++,e==c))return f;0==g&&(g=h)}}function gn_getVisibleOrg(a,b){return b.items.visibleConf.org||a.children().slice(0,b.items.visible).filter(b.items.filter).length}function gn_getVisibleItemsNext(a,b,c){for(var d=0,e=0,f=c,g=a.length-1;g>=f;f++){var h=a.eq(f);if(d+=h.is(":visible")?h[b.d.outerWidth](!0):0,d>b.maxDimension)return e;if(e++,e==g+1)return e;f==g&&(f=-1)}}function gn_getVisibleItemsNextTestCircular(a,b,c,d){var e=gn_getVisibleItemsNext(a,b,c);return b.circular||c+e>d&&(e=d-c),e}function gn_getVisibleItemsNextFilter(a,b,c){return gn_getItemsNextFilter(a,b.items.filter,b.items.visibleConf.org,c,b.circular)}function gn_getScrollItemsNextFilter(a,b,c,d){return gn_getItemsNextFilter(a,b.items.filter,d+1,c,b.circular)-1}function gn_getItemsNextFilter(a,b,c,d){for(var f=0,g=0,h=d,i=a.length-1;i>=h;h++){if(g++,g>=i)return g;var j=a.eq(h);if(j.is(b)&&(f++,f==c))return g;h==i&&(h=-1)}}function gi_getCurrentItems(a,b){return a.slice(0,b.items.visible)}function gi_getOldItemsPrev(a,b,c){return a.slice(c,b.items.visibleConf.old+c)}function gi_getNewItemsPrev(a,b){return a.slice(0,b.items.visible)}function gi_getOldItemsNext(a,b){return a.slice(0,b.items.visibleConf.old)}function gi_getNewItemsNext(a,b,c){return a.slice(c,b.items.visible+c)}function sz_storeMargin(a,b,c){b.usePadding&&(is_string(c)||(c="_cfs_origCssMargin"),a.each(function(){var a=$(this),d=parseInt(a.css(b.d.marginRight),10);is_number(d)||(d=0),a.data(c,d)}))}function sz_resetMargin(a,b,c){if(b.usePadding){var d=is_boolean(c)?c:!1;is_number(c)||(c=0),sz_storeMargin(a,b,"_cfs_tempCssMargin"),a.each(function(){var a=$(this);a.css(b.d.marginRight,d?a.data("_cfs_tempCssMargin"):c+a.data("_cfs_origCssMargin"))})}}function sz_storeOrigCss(a){a.each(function(){var a=$(this);a.data("_cfs_origCss",a.attr("style")||"")})}function sz_restoreOrigCss(a){a.each(function(){var a=$(this);a.attr("style",a.data("_cfs_origCss")||"")})}function sz_setResponsiveSizes(a,b){var d=(a.items.visible,a.items[a.d.width]),e=a[a.d.height],f=is_percentage(e);b.each(function(){var b=$(this),c=d-ms_getPaddingBorderMargin(b,a,"Width");b[a.d.width](c),f&&b[a.d.height](ms_getPercentage(c,e))})}function sz_setSizes(a,b){var c=a.parent(),d=a.children(),e=gi_getCurrentItems(d,b),f=cf_mapWrapperSizes(ms_getSizes(e,b,!0),b,!1);if(c.css(f),b.usePadding){var g=b.padding,h=g[b.d[1]];b.align&&0>h&&(h=0);var i=e.last();i.css(b.d.marginRight,i.data("_cfs_origCssMargin")+h),a.css(b.d.top,g[b.d[0]]),a.css(b.d.left,g[b.d[3]])}return a.css(b.d.width,f[b.d.width]+2*ms_getTotalSize(d,b,"width")),a.css(b.d.height,ms_getLargestSize(d,b,"height")),f}function ms_getSizes(a,b,c){return[ms_getTotalSize(a,b,"width",c),ms_getLargestSize(a,b,"height",c)]}function ms_getLargestSize(a,b,c,d){return is_boolean(d)||(d=!1),is_number(b[b.d[c]])&&d?b[b.d[c]]:is_number(b.items[b.d[c]])?b.items[b.d[c]]:(c=c.toLowerCase().indexOf("width")>-1?"outerWidth":"outerHeight",ms_getTrueLargestSize(a,b,c))}function ms_getTrueLargestSize(a,b,c){for(var d=0,e=0,f=a.length;f>e;e++){var g=a.eq(e),h=g.is(":visible")?g[b.d[c]](!0):0;h>d&&(d=h)}return d}function ms_getTotalSize(a,b,c,d){if(is_boolean(d)||(d=!1),is_number(b[b.d[c]])&&d)return b[b.d[c]];if(is_number(b.items[b.d[c]]))return b.items[b.d[c]]*a.length;for(var e=c.toLowerCase().indexOf("width")>-1?"outerWidth":"outerHeight",f=0,g=0,h=a.length;h>g;g++){var i=a.eq(g);f+=i.is(":visible")?i[b.d[e]](!0):0}return f}function ms_getParentSize(a,b,c){var d=a.is(":visible");d&&a.hide();var e=a.parent()[b.d[c]]();return d&&a.show(),e}function ms_getMaxDimension(a,b){return is_number(a[a.d.width])?a[a.d.width]:b}function ms_hasVariableSizes(a,b,c){for(var d=!1,e=!1,f=0,g=a.length;g>f;f++){var h=a.eq(f),i=h.is(":visible")?h[b.d[c]](!0):0;d===!1?d=i:d!=i&&(e=!0),0==d&&(e=!0)}return e}function ms_getPaddingBorderMargin(a,b,c){return a[b.d["outer"+c]](!0)-a[b.d[c.toLowerCase()]]()}function ms_getPercentage(a,b){if(is_percentage(b)){if(b=parseInt(b.slice(0,-1),10),!is_number(b))return a;a*=b/100}return a}function cf_e(a,b,c,d,e){return is_boolean(c)||(c=!0),is_boolean(d)||(d=!0),is_boolean(e)||(e=!1),c&&(a=b.events.prefix+a),d&&(a=a+"."+b.events.namespace),d&&e&&(a+=b.serialNumber),a}function cf_c(a,b){return is_string(b.classnames[a])?b.classnames[a]:a}function cf_mapWrapperSizes(a,b,c){is_boolean(c)||(c=!0);var d=b.usePadding&&c?b.padding:[0,0,0,0],e={};return e[b.d.width]=a[0]+d[1]+d[3],e[b.d.height]=a[1]+d[0]+d[2],e}function cf_sortParams(a,b){for(var c=[],d=0,e=a.length;e>d;d++)for(var f=0,g=b.length;g>f;f++)if(b[f].indexOf(typeof a[d])>-1&&is_undefined(c[f])){c[f]=a[d];break}return c}function cf_getPadding(a){if(is_undefined(a))return[0,0,0,0];if(is_number(a))return[a,a,a,a];if(is_string(a)&&(a=a.split("px").join("").split("em").join("").split(" ")),!is_array(a))return[0,0,0,0];for(var b=0;4>b;b++)a[b]=parseInt(a[b],10);switch(a.length){case 0:return[0,0,0,0];case 1:return[a[0],a[0],a[0],a[0]];case 2:return[a[0],a[1],a[0],a[1]];case 3:return[a[0],a[1],a[2],a[1]];default:return[a[0],a[1],a[2],a[3]]}}function cf_getAlignPadding(a,b){var c=is_number(b[b.d.width])?Math.ceil(b[b.d.width]-ms_getTotalSize(a,b,"width")):0;switch(b.align){case"left":return[0,c];case"right":return[c,0];case"center":default:return[Math.ceil(c/2),Math.floor(c/2)]}}function cf_getDimensions(a){for(var b=[["width","innerWidth","outerWidth","height","innerHeight","outerHeight","left","top","marginRight",0,1,2,3],["height","innerHeight","outerHeight","width","innerWidth","outerWidth","top","left","marginBottom",3,2,1,0]],c=b[0].length,d="right"==a.direction||"left"==a.direction?0:1,e={},f=0;c>f;f++)e[b[0][f]]=b[d][f];return e}function cf_getAdjust(a,b,c,d){var e=a;if(is_function(c))e=c.call(d,e);else if(is_string(c)){var f=c.split("+"),g=c.split("-");if(g.length>f.length)var h=!0,i=g[0],j=g[1];else var h=!1,i=f[0],j=f[1];switch(i){case"even":e=1==a%2?a-1:a;break;case"odd":e=0==a%2?a-1:a;break;default:e=a}j=parseInt(j,10),is_number(j)&&(h&&(j=-j),e+=j)}return(!is_number(e)||1>e)&&(e=1),e}function cf_getItemsAdjust(a,b,c,d){return cf_getItemAdjustMinMax(cf_getAdjust(a,b,c,d),b.items.visibleConf)}function cf_getItemAdjustMinMax(a,b){return is_number(b.min)&&b.min>a&&(a=b.min),is_number(b.max)&&a>b.max&&(a=b.max),1>a&&(a=1),a}function cf_getSynchArr(a){is_array(a)||(a=[[a]]),is_array(a[0])||(a=[a]);for(var b=0,c=a.length;c>b;b++)is_string(a[b][0])&&(a[b][0]=$(a[b][0])),is_boolean(a[b][1])||(a[b][1]=!0),is_boolean(a[b][2])||(a[b][2]=!0),is_number(a[b][3])||(a[b][3]=0);return a}function cf_getKeyCode(a){return"right"==a?39:"left"==a?37:"up"==a?38:"down"==a?40:-1}function cf_setCookie(a,b,c){if(a){var d=b.triggerHandler(cf_e("currentPosition",c));$.fn.carouFredSel.cookie.set(a,d)}}function cf_getCookie(a){var b=$.fn.carouFredSel.cookie.get(a);return""==b?0:b}function in_mapCss(a,b){for(var c={},d=0,e=b.length;e>d;d++)c[b[d]]=a.css(b[d]);return c}function in_complementItems(a,b,c,d){return is_object(a.visibleConf)||(a.visibleConf={}),is_object(a.sizesConf)||(a.sizesConf={}),0==a.start&&is_number(d)&&(a.start=d),is_object(a.visible)?(a.visibleConf.min=a.visible.min,a.visibleConf.max=a.visible.max,a.visible=!1):is_string(a.visible)?("variable"==a.visible?a.visibleConf.variable=!0:a.visibleConf.adjust=a.visible,a.visible=!1):is_function(a.visible)&&(a.visibleConf.adjust=a.visible,a.visible=!1),is_string(a.filter)||(a.filter=c.filter(":hidden").length>0?":visible":"*"),a[b.d.width]||(b.responsive?(debug(!0,"Set a "+b.d.width+" for the items!"),a[b.d.width]=ms_getTrueLargestSize(c,b,"outerWidth")):a[b.d.width]=ms_hasVariableSizes(c,b,"outerWidth")?"variable":c[b.d.outerWidth](!0)),a[b.d.height]||(a[b.d.height]=ms_hasVariableSizes(c,b,"outerHeight")?"variable":c[b.d.outerHeight](!0)),a.sizesConf.width=a.width,a.sizesConf.height=a.height,a}function in_complementVisibleItems(a,b){return"variable"==a.items[a.d.width]&&(a.items.visibleConf.variable=!0),a.items.visibleConf.variable||(is_number(a[a.d.width])?a.items.visible=Math.floor(a[a.d.width]/a.items[a.d.width]):(a.items.visible=Math.floor(b/a.items[a.d.width]),a[a.d.width]=a.items.visible*a.items[a.d.width],a.items.visibleConf.adjust||(a.align=!1)),("Infinity"==a.items.visible||1>a.items.visible)&&(debug(!0,'Not a valid number of visible items: Set to "variable".'),a.items.visibleConf.variable=!0)),a}function in_complementPrimarySize(a,b,c){return"auto"==a&&(a=ms_getTrueLargestSize(c,b,"outerWidth")),a}function in_complementSecondarySize(a,b,c){return"auto"==a&&(a=ms_getTrueLargestSize(c,b,"outerHeight")),a||(a=b.items[b.d.height]),a}function in_getAlignPadding(a,b){var c=cf_getAlignPadding(gi_getCurrentItems(b,a),a);return a.padding[a.d[1]]=c[1],a.padding[a.d[3]]=c[0],a}function in_getResponsiveValues(a,b){var d=cf_getItemAdjustMinMax(Math.ceil(a[a.d.width]/a.items[a.d.width]),a.items.visibleConf);d>b.length&&(d=b.length);var e=Math.floor(a[a.d.width]/d);return a.items.visible=d,a.items[a.d.width]=e,a[a.d.width]=d*e,a}function bt_pauseOnHoverConfig(a){if(is_string(a))var b=a.indexOf("immediate")>-1?!0:!1,c=a.indexOf("resume")>-1?!0:!1;else var b=c=!1;return[b,c]}function bt_mousesheelNumber(a){return is_number(a)?a:null}function is_null(a){return null===a}function is_undefined(a){return is_null(a)||a===void 0||""===a||"undefined"===a}function is_array(a){return a instanceof Array}function is_jquery(a){return a instanceof jQuery}function is_object(a){return(a instanceof Object||"object"==typeof a)&&!is_null(a)&&!is_jquery(a)&&!is_array(a)&&!is_function(a)}function is_number(a){return(a instanceof Number||"number"==typeof a)&&!isNaN(a)}function is_string(a){return(a instanceof String||"string"==typeof a)&&!is_undefined(a)&&!is_true(a)&&!is_false(a)}function is_function(a){return a instanceof Function||"function"==typeof a}function is_boolean(a){return a instanceof Boolean||"boolean"==typeof a||is_true(a)||is_false(a)}function is_true(a){return a===!0||"true"===a}function is_false(a){return a===!1||"false"===a}function is_percentage(a){return is_string(a)&&"%"==a.slice(-1)}function getTime(){return(new Date).getTime()}function deprecated(a,b){debug(!0,a+" is DEPRECATED, support for it will be removed. Use "+b+" instead.")}function debug(a,b){if(!is_undefined(window.console)&&!is_undefined(window.console.log)){if(is_object(a)){var c=" ("+a.selector+")";a=a.debug}else var c="";if(!a)return!1;b=is_string(b)?"carouFredSel"+c+": "+b:["carouFredSel"+c+":",b],window.console.log(b)}return!1}$.fn.carouFredSel||($.fn.caroufredsel=$.fn.carouFredSel=function(options,configs){if(0==this.length)return debug(!0,'No element found for "'+this.selector+'".'),this;if(this.length>1)return this.each(function(){$(this).carouFredSel(options,configs)});var $cfs=this,$tt0=this[0],starting_position=!1;$cfs.data("_cfs_isCarousel")&&(starting_position=$cfs.triggerHandler("_cfs_triggerEvent","currentPosition"),$cfs.trigger("_cfs_triggerEvent",["destroy",!0]));var FN={};FN._init=function(a,b,c){a=go_getObject($tt0,a),a.items=go_getItemsObject($tt0,a.items),a.scroll=go_getScrollObject($tt0,a.scroll),a.auto=go_getAutoObject($tt0,a.auto),a.prev=go_getPrevNextObject($tt0,a.prev),a.next=go_getPrevNextObject($tt0,a.next),a.pagination=go_getPaginationObject($tt0,a.pagination),a.swipe=go_getSwipeObject($tt0,a.swipe),a.mousewheel=go_getMousewheelObject($tt0,a.mousewheel),b&&(opts_orig=$.extend(!0,{},$.fn.carouFredSel.defaults,a)),opts=$.extend(!0,{},$.fn.carouFredSel.defaults,a),opts.d=cf_getDimensions(opts),crsl.direction="up"==opts.direction||"left"==opts.direction?"next":"prev";var d=$cfs.children(),e=ms_getParentSize($wrp,opts,"width");if(is_true(opts.cookie)&&(opts.cookie="caroufredsel_cookie_"+conf.serialNumber),opts.maxDimension=ms_getMaxDimension(opts,e),opts.items=in_complementItems(opts.items,opts,d,c),opts[opts.d.width]=in_complementPrimarySize(opts[opts.d.width],opts,d),opts[opts.d.height]=in_complementSecondarySize(opts[opts.d.height],opts,d),opts.responsive&&(is_percentage(opts[opts.d.width])||(opts[opts.d.width]="100%")),is_percentage(opts[opts.d.width])&&(crsl.upDateOnWindowResize=!0,crsl.primarySizePercentage=opts[opts.d.width],opts[opts.d.width]=ms_getPercentage(e,crsl.primarySizePercentage),opts.items.visible||(opts.items.visibleConf.variable=!0)),opts.responsive?(opts.usePadding=!1,opts.padding=[0,0,0,0],opts.align=!1,opts.items.visibleConf.variable=!1):(opts.items.visible||(opts=in_complementVisibleItems(opts,e)),opts[opts.d.width]||(!opts.items.visibleConf.variable&&is_number(opts.items[opts.d.width])&&"*"==opts.items.filter?(opts[opts.d.width]=opts.items.visible*opts.items[opts.d.width],opts.align=!1):opts[opts.d.width]="variable"),is_undefined(opts.align)&&(opts.align=is_number(opts[opts.d.width])?"center":!1),opts.items.visibleConf.variable&&(opts.items.visible=gn_getVisibleItemsNext(d,opts,0))),"*"==opts.items.filter||opts.items.visibleConf.variable||(opts.items.visibleConf.org=opts.items.visible,opts.items.visible=gn_getVisibleItemsNextFilter(d,opts,0)),opts.items.visible=cf_getItemsAdjust(opts.items.visible,opts,opts.items.visibleConf.adjust,$tt0),opts.items.visibleConf.old=opts.items.visible,opts.responsive)opts.items.visibleConf.min||(opts.items.visibleConf.min=opts.items.visible),opts.items.visibleConf.max||(opts.items.visibleConf.max=opts.items.visible),opts=in_getResponsiveValues(opts,d,e);else switch(opts.padding=cf_getPadding(opts.padding),"top"==opts.align?opts.align="left":"bottom"==opts.align&&(opts.align="right"),opts.align){case"center":case"left":case"right":"variable"!=opts[opts.d.width]&&(opts=in_getAlignPadding(opts,d),opts.usePadding=!0);break;default:opts.align=!1,opts.usePadding=0==opts.padding[0]&&0==opts.padding[1]&&0==opts.padding[2]&&0==opts.padding[3]?!1:!0}is_number(opts.scroll.duration)||(opts.scroll.duration=500),is_undefined(opts.scroll.items)&&(opts.scroll.items=opts.responsive||opts.items.visibleConf.variable||"*"!=opts.items.filter?"visible":opts.items.visible),opts.auto=$.extend(!0,{},opts.scroll,opts.auto),opts.prev=$.extend(!0,{},opts.scroll,opts.prev),opts.next=$.extend(!0,{},opts.scroll,opts.next),opts.pagination=$.extend(!0,{},opts.scroll,opts.pagination),opts.auto=go_complementAutoObject($tt0,opts.auto),opts.prev=go_complementPrevNextObject($tt0,opts.prev),opts.next=go_complementPrevNextObject($tt0,opts.next),opts.pagination=go_complementPaginationObject($tt0,opts.pagination),opts.swipe=go_complementSwipeObject($tt0,opts.swipe),opts.mousewheel=go_complementMousewheelObject($tt0,opts.mousewheel),opts.synchronise&&(opts.synchronise=cf_getSynchArr(opts.synchronise)),opts.auto.onPauseStart&&(opts.auto.onTimeoutStart=opts.auto.onPauseStart,deprecated("auto.onPauseStart","auto.onTimeoutStart")),opts.auto.onPausePause&&(opts.auto.onTimeoutPause=opts.auto.onPausePause,deprecated("auto.onPausePause","auto.onTimeoutPause")),opts.auto.onPauseEnd&&(opts.auto.onTimeoutEnd=opts.auto.onPauseEnd,deprecated("auto.onPauseEnd","auto.onTimeoutEnd")),opts.auto.pauseDuration&&(opts.auto.timeoutDuration=opts.auto.pauseDuration,deprecated("auto.pauseDuration","auto.timeoutDuration"))},FN._build=function(){$cfs.data("_cfs_isCarousel",!0);var a=$cfs.children(),b=in_mapCss($cfs,["textAlign","float","position","top","right","bottom","left","zIndex","width","height","marginTop","marginRight","marginBottom","marginLeft"]),c="relative";switch(b.position){case"absolute":case"fixed":c=b.position}"parent"==conf.wrapper?sz_storeOrigCss($wrp):$wrp.css(b),$wrp.css({overflow:"hidden",position:c}),sz_storeOrigCss($cfs),$cfs.data("_cfs_origCssZindex",b.zIndex),$cfs.css({textAlign:"left","float":"none",position:"absolute",top:0,right:"auto",bottom:"auto",left:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0}),sz_storeMargin(a,opts),sz_storeOrigCss(a),opts.responsive&&sz_setResponsiveSizes(opts,a)},FN._bind_events=function(){FN._unbind_events(),$cfs.bind(cf_e("stop",conf),function(a,b){return a.stopPropagation(),crsl.isStopped||opts.auto.button&&opts.auto.button.addClass(cf_c("stopped",conf)),crsl.isStopped=!0,opts.auto.play&&(opts.auto.play=!1,$cfs.trigger(cf_e("pause",conf),b)),!0}),$cfs.bind(cf_e("finish",conf),function(a){return a.stopPropagation(),crsl.isScrolling&&sc_stopScroll(scrl),!0}),$cfs.bind(cf_e("pause",conf),function(a,b,c){if(a.stopPropagation(),tmrs=sc_clearTimers(tmrs),b&&crsl.isScrolling){scrl.isStopped=!0;var d=getTime()-scrl.startTime;scrl.duration-=d,scrl.pre&&(scrl.pre.duration-=d),scrl.post&&(scrl.post.duration-=d),sc_stopScroll(scrl,!1)}if(crsl.isPaused||crsl.isScrolling||c&&(tmrs.timePassed+=getTime()-tmrs.startTime),crsl.isPaused||opts.auto.button&&opts.auto.button.addClass(cf_c("paused",conf)),crsl.isPaused=!0,opts.auto.onTimeoutPause){var e=opts.auto.timeoutDuration-tmrs.timePassed,f=100-Math.ceil(100*e/opts.auto.timeoutDuration);opts.auto.onTimeoutPause.call($tt0,f,e)}return!0}),$cfs.bind(cf_e("play",conf),function(a,b,c,d){a.stopPropagation(),tmrs=sc_clearTimers(tmrs);var e=[b,c,d],f=["string","number","boolean"],g=cf_sortParams(e,f);if(b=g[0],c=g[1],d=g[2],"prev"!=b&&"next"!=b&&(b=crsl.direction),is_number(c)||(c=0),is_boolean(d)||(d=!1),d&&(crsl.isStopped=!1,opts.auto.play=!0),!opts.auto.play)return a.stopImmediatePropagation(),debug(conf,"Carousel stopped: Not scrolling.");crsl.isPaused&&opts.auto.button&&(opts.auto.button.removeClass(cf_c("stopped",conf)),opts.auto.button.removeClass(cf_c("paused",conf))),crsl.isPaused=!1,tmrs.startTime=getTime();var h=opts.auto.timeoutDuration+c;return dur2=h-tmrs.timePassed,perc=100-Math.ceil(100*dur2/h),opts.auto.progress&&(tmrs.progress=setInterval(function(){var a=getTime()-tmrs.startTime+tmrs.timePassed,b=Math.ceil(100*a/h);opts.auto.progress.updater.call(opts.auto.progress.bar[0],b)},opts.auto.progress.interval)),tmrs.auto=setTimeout(function(){opts.auto.progress&&opts.auto.progress.updater.call(opts.auto.progress.bar[0],100),opts.auto.onTimeoutEnd&&opts.auto.onTimeoutEnd.call($tt0,perc,dur2),crsl.isScrolling?$cfs.trigger(cf_e("play",conf),b):$cfs.trigger(cf_e(b,conf),opts.auto)},dur2),opts.auto.onTimeoutStart&&opts.auto.onTimeoutStart.call($tt0,perc,dur2),!0}),$cfs.bind(cf_e("resume",conf),function(a){return a.stopPropagation(),scrl.isStopped?(scrl.isStopped=!1,crsl.isPaused=!1,crsl.isScrolling=!0,scrl.startTime=getTime(),sc_startScroll(scrl,conf)):$cfs.trigger(cf_e("play",conf)),!0}),$cfs.bind(cf_e("prev",conf)+" "+cf_e("next",conf),function(a,b,c,d,e){if(a.stopPropagation(),crsl.isStopped||$cfs.is(":hidden"))return a.stopImmediatePropagation(),debug(conf,"Carousel stopped or hidden: Not scrolling.");var f=is_number(opts.items.minimum)?opts.items.minimum:opts.items.visible+1;if(f>itms.total)return a.stopImmediatePropagation(),debug(conf,"Not enough items ("+itms.total+" total, "+f+" needed): Not scrolling.");var g=[b,c,d,e],h=["object","number/string","function","boolean"],i=cf_sortParams(g,h);b=i[0],c=i[1],d=i[2],e=i[3];var j=a.type.slice(conf.events.prefix.length);if(is_object(b)||(b={}),is_function(d)&&(b.onAfter=d),is_boolean(e)&&(b.queue=e),b=$.extend(!0,{},opts[j],b),b.conditions&&!b.conditions.call($tt0,j))return a.stopImmediatePropagation(),debug(conf,'Callback "conditions" returned false.');if(!is_number(c)){if("*"!=opts.items.filter)c="visible";else for(var k=[c,b.items,opts[j].items],i=0,l=k.length;l>i;i++)if(is_number(k[i])||"page"==k[i]||"visible"==k[i]){c=k[i];break}switch(c){case"page":return a.stopImmediatePropagation(),$cfs.triggerHandler(cf_e(j+"Page",conf),[b,d]);case"visible":opts.items.visibleConf.variable||"*"!=opts.items.filter||(c=opts.items.visible)}}if(scrl.isStopped)return $cfs.trigger(cf_e("resume",conf)),$cfs.trigger(cf_e("queue",conf),[j,[b,c,d]]),a.stopImmediatePropagation(),debug(conf,"Carousel resumed scrolling.");if(b.duration>0&&crsl.isScrolling)return b.queue&&("last"==b.queue&&(queu=[]),("first"!=b.queue||0==queu.length)&&$cfs.trigger(cf_e("queue",conf),[j,[b,c,d]])),a.stopImmediatePropagation(),debug(conf,"Carousel currently scrolling.");if(tmrs.timePassed=0,$cfs.trigger(cf_e("slide_"+j,conf),[b,c]),opts.synchronise)for(var m=opts.synchronise,n=[b,c],o=0,l=m.length;l>o;o++){var p=j;m[o][2]||(p="prev"==p?"next":"prev"),m[o][1]||(n[0]=m[o][0].triggerHandler("_cfs_triggerEvent",["configuration",p])),n[1]=c+m[o][3],m[o][0].trigger("_cfs_triggerEvent",["slide_"+p,n])}return!0}),$cfs.bind(cf_e("slide_prev",conf),function(a,b,c){a.stopPropagation();var d=$cfs.children();if(!opts.circular&&0==itms.first)return opts.infinite&&$cfs.trigger(cf_e("next",conf),itms.total-1),a.stopImmediatePropagation();if(sz_resetMargin(d,opts),!is_number(c)){if(opts.items.visibleConf.variable)c=gn_getVisibleItemsPrev(d,opts,itms.total-1);else if("*"!=opts.items.filter){var e=is_number(b.items)?b.items:gn_getVisibleOrg($cfs,opts);c=gn_getScrollItemsPrevFilter(d,opts,itms.total-1,e)}else c=opts.items.visible;c=cf_getAdjust(c,opts,b.items,$tt0)}if(opts.circular||itms.total-c=opts.items.visible+c&&itms.total>c&&(c++,f=cf_getItemsAdjust(gn_getVisibleItemsNext(d,opts,itms.total-c),opts,opts.items.visibleConf.adjust,$tt0)),opts.items.visible=f}else if("*"!=opts.items.filter){var f=gn_getVisibleItemsNextFilter(d,opts,itms.total-c);opts.items.visible=cf_getItemsAdjust(f,opts,opts.items.visibleConf.adjust,$tt0)}if(sz_resetMargin(d,opts,!0),0==c)return a.stopImmediatePropagation(),debug(conf,"0 items to scroll: Not scrolling.");for(debug(conf,"Scrolling "+c+" items backward."),itms.first+=c;itms.first>=itms.total;)itms.first-=itms.total;opts.circular||(0==itms.first&&b.onEnd&&b.onEnd.call($tt0,"prev"),opts.infinite||nv_enableNavi(opts,itms.first,conf)),$cfs.children().slice(itms.total-c,itms.total).prependTo($cfs),itms.totall?opts.padding[opts.d[3]]:0,p=!1,q=$();if(c>opts.items.visible&&(q=d.slice(opts.items.visibleConf.old,c),"directscroll"==b.fx)){var r=opts.items[opts.d.width];p=q,i=k,sc_hideHiddenItems(p),opts.items[opts.d.width]="variable"}var s=!1,t=ms_getTotalSize(d.slice(0,c),opts,"width"),u=cf_mapWrapperSizes(ms_getSizes(h,opts,!0),opts,!opts.usePadding),v=0,w={},x={},y={},z={},A={},B={},C={},D=sc_getDuration(b,opts,c,t);switch(b.fx){case"cover":case"cover-fade":v=ms_getTotalSize(d.slice(0,opts.items.visible),opts,"width")}p&&(opts.items[opts.d.width]=r),sz_resetMargin(d,opts,!0),m>=0&&sz_resetMargin(j,opts,opts.padding[opts.d[1]]),l>=0&&sz_resetMargin(i,opts,opts.padding[opts.d[3]]),opts.align&&(opts.padding[opts.d[1]]=m,opts.padding[opts.d[3]]=l),B[opts.d.left]=-(t-o),C[opts.d.left]=-(v-o),x[opts.d.left]=u[opts.d.width];var E=function(){},F=function(){},G=function(){},H=function(){},I=function(){},J=function(){},K=function(){},L=function(){},M=function(){},N=function(){},O=function(){};switch(b.fx){case"crossfade":case"cover":case"cover-fade":case"uncover":case"uncover-fade":s=$cfs.clone(!0).appendTo($wrp)}switch(b.fx){case"crossfade":case"uncover":case"uncover-fade":s.children().slice(0,c).remove(),s.children().slice(opts.items.visibleConf.old).remove();break;case"cover":case"cover-fade":s.children().slice(opts.items.visible).remove(),s.css(C)}if($cfs.css(B),scrl=sc_setScroll(D,b.easing,conf),w[opts.d.left]=opts.usePadding?opts.padding[opts.d[3]]:0,("variable"==opts[opts.d.width]||"variable"==opts[opts.d.height])&&(E=function(){$wrp.css(u)},F=function(){scrl.anims.push([$wrp,u])}),opts.usePadding){switch(k.not(i).length&&(y[opts.d.marginRight]=i.data("_cfs_origCssMargin"),0>l?i.css(y):(K=function(){i.css(y)},L=function(){scrl.anims.push([i,y])})),b.fx){case"cover":case"cover-fade":s.children().eq(c-1).css(y)}k.not(j).length&&(z[opts.d.marginRight]=j.data("_cfs_origCssMargin"),G=function(){j.css(z)},H=function(){scrl.anims.push([j,z])}),m>=0&&(A[opts.d.marginRight]=k.data("_cfs_origCssMargin")+opts.padding[opts.d[1]],I=function(){k.css(A)},J=function(){scrl.anims.push([k,A])})}O=function(){$cfs.css(w)};var P=opts.items.visible+c-itms.total;N=function(){if(P>0&&($cfs.children().slice(itms.total).remove(),g=$($cfs.children().slice(itms.total-(opts.items.visible-P)).get().concat($cfs.children().slice(0,P).get()))),sc_showHiddenItems(p),opts.usePadding){var a=$cfs.children().eq(opts.items.visible+c-1);a.css(opts.d.marginRight,a.data("_cfs_origCssMargin"))}};var Q=sc_mapCallbackArguments(g,q,h,c,"prev",D,u);switch(M=function(){sc_afterScroll($cfs,s,b),crsl.isScrolling=!1,clbk.onAfter=sc_fireCallbacks($tt0,b,"onAfter",Q,clbk),queu=sc_fireQueue($cfs,queu,conf),crsl.isPaused||$cfs.trigger(cf_e("play",conf))},crsl.isScrolling=!0,tmrs=sc_clearTimers(tmrs),clbk.onBefore=sc_fireCallbacks($tt0,b,"onBefore",Q,clbk),b.fx){case"none":$cfs.css(w),E(),G(),I(),K(),O(),N(),M();break;case"fade":scrl.anims.push([$cfs,{opacity:0},function(){E(),G(),I(),K(),O(),N(),scrl=sc_setScroll(D,b.easing,conf),scrl.anims.push([$cfs,{opacity:1},M]),sc_startScroll(scrl,conf)}]);break;case"crossfade":$cfs.css({opacity:0}),scrl.anims.push([s,{opacity:0}]),scrl.anims.push([$cfs,{opacity:1},M]),F(),G(),I(),K(),O(),N();break;case"cover":scrl.anims.push([s,w,function(){G(),I(),K(),O(),N(),M()}]),F();break;case"cover-fade":scrl.anims.push([$cfs,{opacity:0}]),scrl.anims.push([s,w,function(){G(),I(),K(),O(),N(),M()}]),F();break;case"uncover":scrl.anims.push([s,x,M]),F(),G(),I(),K(),O(),N();break;case"uncover-fade":$cfs.css({opacity:0}),scrl.anims.push([$cfs,{opacity:1}]),scrl.anims.push([s,x,M]),F(),G(),I(),K(),O(),N();break;default:scrl.anims.push([$cfs,w,function(){N(),M()}]),F(),H(),J(),L()}return sc_startScroll(scrl,conf),cf_setCookie(opts.cookie,$cfs,conf),$cfs.trigger(cf_e("updatePageStatus",conf),[!1,u]),!0 16 | }),$cfs.bind(cf_e("slide_next",conf),function(a,b,c){a.stopPropagation();var d=$cfs.children();if(!opts.circular&&itms.first==opts.items.visible)return opts.infinite&&$cfs.trigger(cf_e("prev",conf),itms.total-1),a.stopImmediatePropagation();if(sz_resetMargin(d,opts),!is_number(c)){if("*"!=opts.items.filter){var e=is_number(b.items)?b.items:gn_getVisibleOrg($cfs,opts);c=gn_getScrollItemsNextFilter(d,opts,0,e)}else c=opts.items.visible;c=cf_getAdjust(c,opts,b.items,$tt0)}var f=0==itms.first?itms.total:itms.first;if(!opts.circular){if(opts.items.visibleConf.variable)var g=gn_getVisibleItemsNext(d,opts,c),e=gn_getVisibleItemsPrev(d,opts,f-1);else var g=opts.items.visible,e=opts.items.visible;c+g>f&&(c=f-e)}if(opts.items.visibleConf.old=opts.items.visible,opts.items.visibleConf.variable){for(var g=cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(d,opts,c,f),opts,opts.items.visibleConf.adjust,$tt0);opts.items.visible-c>=g&&itms.total>c;)c++,g=cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(d,opts,c,f),opts,opts.items.visibleConf.adjust,$tt0);opts.items.visible=g}else if("*"!=opts.items.filter){var g=gn_getVisibleItemsNextFilter(d,opts,c);opts.items.visible=cf_getItemsAdjust(g,opts,opts.items.visibleConf.adjust,$tt0)}if(sz_resetMargin(d,opts,!0),0==c)return a.stopImmediatePropagation(),debug(conf,"0 items to scroll: Not scrolling.");for(debug(conf,"Scrolling "+c+" items forward."),itms.first-=c;0>itms.first;)itms.first+=itms.total;opts.circular||(itms.first==opts.items.visible&&b.onEnd&&b.onEnd.call($tt0,"next"),opts.infinite||nv_enableNavi(opts,itms.first,conf)),itms.totalopts.items.visibleConf.old&&(q=d.slice(opts.items.visibleConf.old,c),"directscroll"==b.fx)){var r=opts.items[opts.d.width];p=q,j=k,sc_hideHiddenItems(p),opts.items[opts.d.width]="variable"}var s=!1,t=ms_getTotalSize(d.slice(0,c),opts,"width"),u=cf_mapWrapperSizes(ms_getSizes(i,opts,!0),opts,!opts.usePadding),v=0,w={},x={},y={},z={},A={},B=sc_getDuration(b,opts,c,t);switch(b.fx){case"uncover":case"uncover-fade":v=ms_getTotalSize(d.slice(0,opts.items.visibleConf.old),opts,"width")}p&&(opts.items[opts.d.width]=r),opts.align&&0>opts.padding[opts.d[1]]&&(opts.padding[opts.d[1]]=0),sz_resetMargin(d,opts,!0),sz_resetMargin(k,opts,opts.padding[opts.d[1]]),opts.align&&(opts.padding[opts.d[1]]=n,opts.padding[opts.d[3]]=m),A[opts.d.left]=opts.usePadding?opts.padding[opts.d[3]]:0;var C=function(){},D=function(){},E=function(){},F=function(){},G=function(){},H=function(){},I=function(){},J=function(){},K=function(){};switch(b.fx){case"crossfade":case"cover":case"cover-fade":case"uncover":case"uncover-fade":s=$cfs.clone(!0).appendTo($wrp),s.children().slice(opts.items.visibleConf.old).remove()}switch(b.fx){case"crossfade":case"cover":case"cover-fade":$cfs.css("zIndex",1),s.css("zIndex",0)}if(scrl=sc_setScroll(B,b.easing,conf),w[opts.d.left]=-t,x[opts.d.left]=-v,0>m&&(w[opts.d.left]+=m),("variable"==opts[opts.d.width]||"variable"==opts[opts.d.height])&&(C=function(){$wrp.css(u)},D=function(){scrl.anims.push([$wrp,u])}),opts.usePadding){var L=l.data("_cfs_origCssMargin");n>=0&&(L+=opts.padding[opts.d[1]]),l.css(opts.d.marginRight,L),j.not(k).length&&(z[opts.d.marginRight]=k.data("_cfs_origCssMargin")),E=function(){k.css(z)},F=function(){scrl.anims.push([k,z])};var M=j.data("_cfs_origCssMargin");m>0&&(M+=opts.padding[opts.d[3]]),y[opts.d.marginRight]=M,G=function(){j.css(y)},H=function(){scrl.anims.push([j,y])}}K=function(){$cfs.css(A)};var N=opts.items.visible+c-itms.total;J=function(){N>0&&$cfs.children().slice(itms.total).remove();var a=$cfs.children().slice(0,c).appendTo($cfs).last();if(N>0&&(i=gi_getCurrentItems(d,opts)),sc_showHiddenItems(p),opts.usePadding){if(itms.total=b?"next":"prev":0==itms.first||itms.first>b?"next":"prev"),"prev"==f&&(b=itms.total-b),$cfs.trigger(cf_e(f,conf),[e,b,g]),!0)}),$cfs.bind(cf_e("prevPage",conf),function(a,b,c){a.stopPropagation();var d=$cfs.triggerHandler(cf_e("currentPage",conf));return $cfs.triggerHandler(cf_e("slideToPage",conf),[d-1,b,"prev",c])}),$cfs.bind(cf_e("nextPage",conf),function(a,b,c){a.stopPropagation();var d=$cfs.triggerHandler(cf_e("currentPage",conf));return $cfs.triggerHandler(cf_e("slideToPage",conf),[d+1,b,"next",c])}),$cfs.bind(cf_e("slideToPage",conf),function(a,b,c,d,e){a.stopPropagation(),is_number(b)||(b=$cfs.triggerHandler(cf_e("currentPage",conf)));var f=opts.pagination.items||opts.items.visible,g=Math.ceil(itms.total/f)-1;return 0>b&&(b=g),b>g&&(b=0),$cfs.triggerHandler(cf_e("slideTo",conf),[b*f,0,!0,c,d,e])}),$cfs.bind(cf_e("jumpToStart",conf),function(a,b){if(a.stopPropagation(),b=b?gn_getItemIndex(b,0,!0,itms,$cfs):0,b+=itms.first,0!=b){if(itms.total>0)for(;b>itms.total;)b-=itms.total;$cfs.prepend($cfs.children().slice(b,itms.total))}return!0}),$cfs.bind(cf_e("synchronise",conf),function(a,b){if(a.stopPropagation(),b)b=cf_getSynchArr(b);else{if(!opts.synchronise)return debug(conf,"No carousel to synchronise.");b=opts.synchronise}for(var c=$cfs.triggerHandler(cf_e("currentPosition",conf)),d=!0,e=0,f=b.length;f>e;e++)b[e][0].triggerHandler(cf_e("slideTo",conf),[c,b[e][3],!0])||(d=!1);return d}),$cfs.bind(cf_e("queue",conf),function(a,b,c){return a.stopPropagation(),is_function(b)?b.call($tt0,queu):is_array(b)?queu=b:is_undefined(b)||queu.push([b,c]),queu}),$cfs.bind(cf_e("insertItem",conf),function(a,b,c,d,e){a.stopPropagation();var f=[b,c,d,e],g=["string/object","string/number/object","boolean","number"],h=cf_sortParams(f,g);if(b=h[0],c=h[1],d=h[2],e=h[3],is_object(b)&&!is_jquery(b)?b=$(b):is_string(b)&&(b=$(b)),!is_jquery(b)||0==b.length)return debug(conf,"Not a valid object.");is_undefined(c)&&(c="end"),sz_storeMargin(b,opts),sz_storeOrigCss(b);var i=c,j="before";"end"==c?d?(0==itms.first?(c=itms.total-1,j="after"):(c=itms.first,itms.first+=b.length),0>c&&(c=0)):(c=itms.total-1,j="after"):c=gn_getItemIndex(c,e,d,itms,$cfs);var k=$cfs.children().eq(c);return k.length?k[j](b):(debug(conf,"Correct insert-position not found! Appending item to the end."),$cfs.append(b)),"end"==i||d||itms.first>c&&(itms.first+=b.length),itms.total=$cfs.children().length,itms.first>=itms.total&&(itms.first-=itms.total),$cfs.trigger(cf_e("updateSizes",conf)),$cfs.trigger(cf_e("linkAnchors",conf)),!0}),$cfs.bind(cf_e("removeItem",conf),function(a,b,c,d){a.stopPropagation();var e=[b,c,d],f=["string/number/object","boolean","number"],g=cf_sortParams(e,f);if(b=g[0],c=g[1],d=g[2],b instanceof $&&b.length>1)return i=$(),b.each(function(){var e=$cfs.trigger(cf_e("removeItem",conf),[$(this),c,d]);e&&(i=i.add(e))}),i;if(is_undefined(b)||"end"==b)i=$cfs.children().last();else{b=gn_getItemIndex(b,d,c,itms,$cfs);var i=$cfs.children().eq(b);i.length&&itms.first>b&&(itms.first-=i.length)}return i&&i.length&&(i.detach(),itms.total=$cfs.children().length,$cfs.trigger(cf_e("updateSizes",conf))),i}),$cfs.bind(cf_e("onBefore",conf)+" "+cf_e("onAfter",conf),function(a,b){a.stopPropagation();var c=a.type.slice(conf.events.prefix.length);return is_array(b)&&(clbk[c]=b),is_function(b)&&clbk[c].push(b),clbk[c]}),$cfs.bind(cf_e("currentPosition",conf),function(a,b){if(a.stopPropagation(),0==itms.first)var c=0;else var c=itms.total-itms.first;return is_function(b)&&b.call($tt0,c),c}),$cfs.bind(cf_e("currentPage",conf),function(a,b){a.stopPropagation();var e,c=opts.pagination.items||opts.items.visible,d=Math.ceil(itms.total/c-1);return e=0==itms.first?0:itms.firste&&(e=0),e>d&&(e=d),is_function(b)&&b.call($tt0,e),e}),$cfs.bind(cf_e("currentVisible",conf),function(a,b){a.stopPropagation();var c=gi_getCurrentItems($cfs.children(),opts);return is_function(b)&&b.call($tt0,c),c}),$cfs.bind(cf_e("slice",conf),function(a,b,c,d){if(a.stopPropagation(),0==itms.total)return!1;var e=[b,c,d],f=["number","number","function"],g=cf_sortParams(e,f);if(b=is_number(g[0])?g[0]:0,c=is_number(g[1])?g[1]:itms.total,d=g[2],b+=itms.first,c+=itms.first,items.total>0){for(;b>itms.total;)b-=itms.total;for(;c>itms.total;)c-=itms.total;for(;0>b;)b+=itms.total;for(;0>c;)c+=itms.total}var i,h=$cfs.children();return i=c>b?h.slice(b,c):$(h.slice(b,itms.total).get().concat(h.slice(0,c).get())),is_function(d)&&d.call($tt0,i),i}),$cfs.bind(cf_e("isPaused",conf)+" "+cf_e("isStopped",conf)+" "+cf_e("isScrolling",conf),function(a,b){a.stopPropagation();var c=a.type.slice(conf.events.prefix.length),d=crsl[c];return is_function(b)&&b.call($tt0,d),d}),$cfs.bind(cf_e("configuration",conf),function(e,a,b,c){e.stopPropagation();var reInit=!1;if(is_function(a))a.call($tt0,opts);else if(is_object(a))opts_orig=$.extend(!0,{},opts_orig,a),b!==!1?reInit=!0:opts=$.extend(!0,{},opts,a);else if(!is_undefined(a))if(is_function(b)){var val=eval("opts."+a);is_undefined(val)&&(val=""),b.call($tt0,val)}else{if(is_undefined(b))return eval("opts."+a);"boolean"!=typeof c&&(c=!0),eval("opts_orig."+a+" = b"),c!==!1?reInit=!0:eval("opts."+a+" = b")}if(reInit){sz_resetMargin($cfs.children(),opts),FN._init(opts_orig),FN._bind_buttons();var sz=sz_setSizes($cfs,opts);$cfs.trigger(cf_e("updatePageStatus",conf),[!0,sz])}return opts}),$cfs.bind(cf_e("linkAnchors",conf),function(a,b,c){return a.stopPropagation(),is_undefined(b)?b=$("body"):is_string(b)&&(b=$(b)),is_jquery(b)&&0!=b.length?(is_string(c)||(c="a.caroufredsel"),b.find(c).each(function(){var a=this.hash||"";a.length>0&&-1!=$cfs.children().index($(a))&&$(this).unbind("click").click(function(b){b.preventDefault(),$cfs.trigger(cf_e("slideTo",conf),a)})}),!0):debug(conf,"Not a valid object.")}),$cfs.bind(cf_e("updatePageStatus",conf),function(a,b){if(a.stopPropagation(),opts.pagination.container){var d=opts.pagination.items||opts.items.visible,e=Math.ceil(itms.total/d);b&&(opts.pagination.anchorBuilder&&(opts.pagination.container.children().remove(),opts.pagination.container.each(function(){for(var a=0;e>a;a++){var b=$cfs.children().eq(gn_getItemIndex(a*d,0,!0,itms,$cfs));$(this).append(opts.pagination.anchorBuilder.call(b[0],a+1))}})),opts.pagination.container.each(function(){$(this).children().unbind(opts.pagination.event).each(function(a){$(this).bind(opts.pagination.event,function(b){b.preventDefault(),$cfs.trigger(cf_e("slideTo",conf),[a*d,-opts.pagination.deviation,!0,opts.pagination])})})}));var f=$cfs.triggerHandler(cf_e("currentPage",conf))+opts.pagination.deviation;return f>=e&&(f=0),0>f&&(f=e-1),opts.pagination.container.each(function(){$(this).children().removeClass(cf_c("selected",conf)).eq(f).addClass(cf_c("selected",conf))}),!0}}),$cfs.bind(cf_e("updateSizes",conf),function(){var b=opts.items.visible,c=$cfs.children(),d=ms_getParentSize($wrp,opts,"width");if(itms.total=c.length,crsl.primarySizePercentage?(opts.maxDimension=d,opts[opts.d.width]=ms_getPercentage(d,crsl.primarySizePercentage)):opts.maxDimension=ms_getMaxDimension(opts,d),opts.responsive?(opts.items.width=opts.items.sizesConf.width,opts.items.height=opts.items.sizesConf.height,opts=in_getResponsiveValues(opts,c,d),b=opts.items.visible,sz_setResponsiveSizes(opts,c)):opts.items.visibleConf.variable?b=gn_getVisibleItemsNext(c,opts,0):"*"!=opts.items.filter&&(b=gn_getVisibleItemsNextFilter(c,opts,0)),!opts.circular&&0!=itms.first&&b>itms.first){if(opts.items.visibleConf.variable)var e=gn_getVisibleItemsPrev(c,opts,itms.first)-itms.first;else if("*"!=opts.items.filter)var e=gn_getVisibleItemsPrevFilter(c,opts,itms.first)-itms.first;else var e=opts.items.visible-itms.first;debug(conf,"Preventing non-circular: sliding "+e+" items backward."),$cfs.trigger(cf_e("prev",conf),e)}opts.items.visible=cf_getItemsAdjust(b,opts,opts.items.visibleConf.adjust,$tt0),opts.items.visibleConf.old=opts.items.visible,opts=in_getAlignPadding(opts,c);var f=sz_setSizes($cfs,opts);return $cfs.trigger(cf_e("updatePageStatus",conf),[!0,f]),nv_showNavi(opts,itms.total,conf),nv_enableNavi(opts,itms.first,conf),f}),$cfs.bind(cf_e("destroy",conf),function(a,b){return a.stopPropagation(),tmrs=sc_clearTimers(tmrs),$cfs.data("_cfs_isCarousel",!1),$cfs.trigger(cf_e("finish",conf)),b&&$cfs.trigger(cf_e("jumpToStart",conf)),sz_restoreOrigCss($cfs.children()),sz_restoreOrigCss($cfs),FN._unbind_events(),FN._unbind_buttons(),"parent"==conf.wrapper?sz_restoreOrigCss($wrp):$wrp.replaceWith($cfs),!0}),$cfs.bind(cf_e("debug",conf),function(){return debug(conf,"Carousel width: "+opts.width),debug(conf,"Carousel height: "+opts.height),debug(conf,"Item widths: "+opts.items.width),debug(conf,"Item heights: "+opts.items.height),debug(conf,"Number of items visible: "+opts.items.visible),opts.auto.play&&debug(conf,"Number of items scrolled automatically: "+opts.auto.items),opts.prev.button&&debug(conf,"Number of items scrolled backward: "+opts.prev.items),opts.next.button&&debug(conf,"Number of items scrolled forward: "+opts.next.items),conf.debug}),$cfs.bind("_cfs_triggerEvent",function(a,b,c){return a.stopPropagation(),$cfs.triggerHandler(cf_e(b,conf),c)})},FN._unbind_events=function(){$cfs.unbind(cf_e("",conf)),$cfs.unbind(cf_e("",conf,!1)),$cfs.unbind("_cfs_triggerEvent")},FN._bind_buttons=function(){if(FN._unbind_buttons(),nv_showNavi(opts,itms.total,conf),nv_enableNavi(opts,itms.first,conf),opts.auto.pauseOnHover){var a=bt_pauseOnHoverConfig(opts.auto.pauseOnHover);$wrp.bind(cf_e("mouseenter",conf,!1),function(){$cfs.trigger(cf_e("pause",conf),a)}).bind(cf_e("mouseleave",conf,!1),function(){$cfs.trigger(cf_e("resume",conf))})}if(opts.auto.button&&opts.auto.button.bind(cf_e(opts.auto.event,conf,!1),function(a){a.preventDefault();var b=!1,c=null;crsl.isPaused?b="play":opts.auto.pauseOnEvent&&(b="pause",c=bt_pauseOnHoverConfig(opts.auto.pauseOnEvent)),b&&$cfs.trigger(cf_e(b,conf),c)}),opts.prev.button&&(opts.prev.button.bind(cf_e(opts.prev.event,conf,!1),function(a){a.preventDefault(),$cfs.trigger(cf_e("prev",conf))}),opts.prev.pauseOnHover)){var a=bt_pauseOnHoverConfig(opts.prev.pauseOnHover);opts.prev.button.bind(cf_e("mouseenter",conf,!1),function(){$cfs.trigger(cf_e("pause",conf),a)}).bind(cf_e("mouseleave",conf,!1),function(){$cfs.trigger(cf_e("resume",conf))})}if(opts.next.button&&(opts.next.button.bind(cf_e(opts.next.event,conf,!1),function(a){a.preventDefault(),$cfs.trigger(cf_e("next",conf))}),opts.next.pauseOnHover)){var a=bt_pauseOnHoverConfig(opts.next.pauseOnHover);opts.next.button.bind(cf_e("mouseenter",conf,!1),function(){$cfs.trigger(cf_e("pause",conf),a)}).bind(cf_e("mouseleave",conf,!1),function(){$cfs.trigger(cf_e("resume",conf))})}if(opts.pagination.container&&opts.pagination.pauseOnHover){var a=bt_pauseOnHoverConfig(opts.pagination.pauseOnHover);opts.pagination.container.bind(cf_e("mouseenter",conf,!1),function(){$cfs.trigger(cf_e("pause",conf),a)}).bind(cf_e("mouseleave",conf,!1),function(){$cfs.trigger(cf_e("resume",conf))})}if((opts.prev.key||opts.next.key)&&$(document).bind(cf_e("keyup",conf,!1,!0,!0),function(a){var b=a.keyCode;b==opts.next.key&&(a.preventDefault(),$cfs.trigger(cf_e("next",conf))),b==opts.prev.key&&(a.preventDefault(),$cfs.trigger(cf_e("prev",conf)))}),opts.pagination.keys&&$(document).bind(cf_e("keyup",conf,!1,!0,!0),function(a){var b=a.keyCode;b>=49&&58>b&&(b=(b-49)*opts.items.visible,itms.total>=b&&(a.preventDefault(),$cfs.trigger(cf_e("slideTo",conf),[b,0,!0,opts.pagination])))}),$.fn.swipe){var b="ontouchstart"in window;if(b&&opts.swipe.onTouch||!b&&opts.swipe.onMouse){var c=$.extend(!0,{},opts.prev,opts.swipe),d=$.extend(!0,{},opts.next,opts.swipe),e=function(){$cfs.trigger(cf_e("prev",conf),[c])},f=function(){$cfs.trigger(cf_e("next",conf),[d])};switch(opts.direction){case"up":case"down":opts.swipe.options.swipeUp=f,opts.swipe.options.swipeDown=e;break;default:opts.swipe.options.swipeLeft=f,opts.swipe.options.swipeRight=e}crsl.swipe&&$cfs.swipe("destroy"),$wrp.swipe(opts.swipe.options),$wrp.css("cursor","move"),crsl.swipe=!0}}if($.fn.mousewheel&&opts.mousewheel){var g=$.extend(!0,{},opts.prev,opts.mousewheel),h=$.extend(!0,{},opts.next,opts.mousewheel);crsl.mousewheel&&$wrp.unbind(cf_e("mousewheel",conf,!1)),$wrp.bind(cf_e("mousewheel",conf,!1),function(a,b){a.preventDefault(),b>0?$cfs.trigger(cf_e("prev",conf),[g]):$cfs.trigger(cf_e("next",conf),[h])}),crsl.mousewheel=!0}if(opts.auto.play&&$cfs.trigger(cf_e("play",conf),opts.auto.delay),crsl.upDateOnWindowResize){var i=function(){$cfs.trigger(cf_e("finish",conf)),opts.auto.pauseOnResize&&!crsl.isPaused&&$cfs.trigger(cf_e("play",conf)),sz_resetMargin($cfs.children(),opts),$cfs.trigger(cf_e("updateSizes",conf))},j=$(window),k=null;if($.debounce&&"debounce"==conf.onWindowResize)k=$.debounce(200,i);else if($.throttle&&"throttle"==conf.onWindowResize)k=$.throttle(300,i);else{var l=0,m=0;k=function(){var a=j.width(),b=j.height();(a!=l||b!=m)&&(i(),l=a,m=b)}}j.bind(cf_e("resize",conf,!1,!0,!0),k)}},FN._unbind_buttons=function(){var b=(cf_e("",conf),cf_e("",conf,!1));ns3=cf_e("",conf,!1,!0,!0),$(document).unbind(ns3),$(window).unbind(ns3),$wrp.unbind(b),opts.auto.button&&opts.auto.button.unbind(b),opts.prev.button&&opts.prev.button.unbind(b),opts.next.button&&opts.next.button.unbind(b),opts.pagination.container&&(opts.pagination.container.unbind(b),opts.pagination.anchorBuilder&&opts.pagination.container.children().remove()),crsl.swipe&&($cfs.swipe("destroy"),$wrp.css("cursor","default"),crsl.swipe=!1),crsl.mousewheel&&(crsl.mousewheel=!1),nv_showNavi(opts,"hide",conf),nv_enableNavi(opts,"removeClass",conf)},is_boolean(configs)&&(configs={debug:configs});var crsl={direction:"next",isPaused:!0,isScrolling:!1,isStopped:!1,mousewheel:!1,swipe:!1},itms={total:$cfs.children().length,first:0},tmrs={auto:null,progress:null,startTime:getTime(),timePassed:0},scrl={isStopped:!1,duration:0,startTime:0,easing:"",anims:[]},clbk={onBefore:[],onAfter:[]},queu=[],conf=$.extend(!0,{},$.fn.carouFredSel.configs,configs),opts={},opts_orig=$.extend(!0,{},options),$wrp="parent"==conf.wrapper?$cfs.parent():$cfs.wrap("<"+conf.wrapper.element+' class="'+conf.wrapper.classname+'" />').parent();if(conf.selector=$cfs.selector,conf.serialNumber=$.fn.carouFredSel.serialNumber++,conf.transition=conf.transition&&$.fn.transition?"transition":"animate",FN._init(opts_orig,!0,starting_position),FN._build(),FN._bind_events(),FN._bind_buttons(),is_array(opts.items.start))var start_arr=opts.items.start;else{var start_arr=[];0!=opts.items.start&&start_arr.push(opts.items.start)}if(opts.cookie&&start_arr.unshift(parseInt(cf_getCookie(opts.cookie),10)),start_arr.length>0)for(var a=0,l=start_arr.length;l>a;a++){var s=start_arr[a];if(0!=s){if(s===!0){if(s=window.location.hash,1>s.length)continue}else"random"===s&&(s=Math.floor(Math.random()*itms.total));if($cfs.triggerHandler(cf_e("slideTo",conf),[s,0,!0,{fx:"none"}]))break}}var siz=sz_setSizes($cfs,opts),itm=gi_getCurrentItems($cfs.children(),opts);return opts.onCreate&&opts.onCreate.call($tt0,{width:siz.width,height:siz.height,items:itm}),$cfs.trigger(cf_e("updatePageStatus",conf),[!0,siz]),$cfs.trigger(cf_e("linkAnchors",conf)),conf.debug&&$cfs.trigger(cf_e("debug",conf)),$cfs},$.fn.carouFredSel.serialNumber=1,$.fn.carouFredSel.defaults={synchronise:!1,infinite:!0,circular:!0,responsive:!1,direction:"left",items:{start:0},scroll:{easing:"swing",duration:500,pauseOnHover:!1,event:"click",queue:!1}},$.fn.carouFredSel.configs={debug:!1,transition:!1,onWindowResize:"throttle",events:{prefix:"",namespace:"cfs"},wrapper:{element:"div",classname:"caroufredsel_wrapper"},classnames:{}},$.fn.carouFredSel.pageAnchorBuilder=function(a){return''+a+""},$.fn.carouFredSel.progressbarUpdater=function(a){$(this).css("width",a+"%")},$.fn.carouFredSel.cookie={get:function(a){a+="=";for(var b=document.cookie.split(";"),c=0,d=b.length;d>c;c++){for(var e=b[c];" "==e.charAt(0);)e=e.slice(1);if(0==e.indexOf(a))return e.slice(a.length)}return 0},set:function(a,b,c){var d="";if(c){var e=new Date;e.setTime(e.getTime()+1e3*60*60*24*c),d="; expires="+e.toGMTString()}document.cookie=a+"="+b+d+"; path=/"},remove:function(a){$.fn.carouFredSel.cookie.set(a,"",-1)}},$.extend($.easing,{quadratic:function(a){var b=a*a;return a*(-b*a+4*b-6*a+4)},cubic:function(a){return a*(4*a*a-9*a+6)},elastic:function(a){var b=a*a;return a*(33*b*b-106*b*a+126*b-67*a+15)}}))})(jQuery); -------------------------------------------------------------------------------- /jquery.carouFredSel-6.2.1.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery carouFredSel 6.2.1 3 | * Demo's and documentation: 4 | * caroufredsel.dev7studios.com 5 | * 6 | * Copyright (c) 2013 Fred Heusschen 7 | * www.frebsite.nl 8 | * 9 | * Dual licensed under the MIT and GPL licenses. 10 | * http://en.wikipedia.org/wiki/MIT_License 11 | * http://en.wikipedia.org/wiki/GNU_General_Public_License 12 | */ 13 | 14 | 15 | (function($) { 16 | 17 | 18 | // LOCAL 19 | 20 | if ( $.fn.carouFredSel ) 21 | { 22 | return; 23 | } 24 | 25 | $.fn.caroufredsel = $.fn.carouFredSel = function(options, configs) 26 | { 27 | 28 | // no element 29 | if (this.length == 0) 30 | { 31 | debug( true, 'No element found for "' + this.selector + '".' ); 32 | return this; 33 | } 34 | 35 | // multiple elements 36 | if (this.length > 1) 37 | { 38 | return this.each(function() { 39 | $(this).carouFredSel(options, configs); 40 | }); 41 | } 42 | 43 | 44 | var $cfs = this, 45 | $tt0 = this[0], 46 | starting_position = false; 47 | 48 | if ($cfs.data('_cfs_isCarousel')) 49 | { 50 | starting_position = $cfs.triggerHandler('_cfs_triggerEvent', 'currentPosition'); 51 | $cfs.trigger('_cfs_triggerEvent', ['destroy', true]); 52 | } 53 | 54 | var FN = {}; 55 | 56 | FN._init = function(o, setOrig, start) 57 | { 58 | o = go_getObject($tt0, o); 59 | 60 | o.items = go_getItemsObject($tt0, o.items); 61 | o.scroll = go_getScrollObject($tt0, o.scroll); 62 | o.auto = go_getAutoObject($tt0, o.auto); 63 | o.prev = go_getPrevNextObject($tt0, o.prev); 64 | o.next = go_getPrevNextObject($tt0, o.next); 65 | o.pagination = go_getPaginationObject($tt0, o.pagination); 66 | o.swipe = go_getSwipeObject($tt0, o.swipe); 67 | o.mousewheel = go_getMousewheelObject($tt0, o.mousewheel); 68 | 69 | if (setOrig) 70 | { 71 | opts_orig = $.extend(true, {}, $.fn.carouFredSel.defaults, o); 72 | } 73 | 74 | opts = $.extend(true, {}, $.fn.carouFredSel.defaults, o); 75 | opts.d = cf_getDimensions(opts); 76 | 77 | crsl.direction = (opts.direction == 'up' || opts.direction == 'left') ? 'next' : 'prev'; 78 | 79 | var a_itm = $cfs.children(), 80 | avail_primary = ms_getParentSize($wrp, opts, 'width'); 81 | 82 | if (is_true(opts.cookie)) 83 | { 84 | opts.cookie = 'caroufredsel_cookie_' + conf.serialNumber; 85 | } 86 | 87 | opts.maxDimension = ms_getMaxDimension(opts, avail_primary); 88 | 89 | // complement items and sizes 90 | opts.items = in_complementItems(opts.items, opts, a_itm, start); 91 | opts[opts.d['width']] = in_complementPrimarySize(opts[opts.d['width']], opts, a_itm); 92 | opts[opts.d['height']] = in_complementSecondarySize(opts[opts.d['height']], opts, a_itm); 93 | 94 | // primary size not set for a responsive carousel 95 | if (opts.responsive) 96 | { 97 | if (!is_percentage(opts[opts.d['width']])) 98 | { 99 | opts[opts.d['width']] = '100%'; 100 | } 101 | } 102 | 103 | // primary size is percentage 104 | if (is_percentage(opts[opts.d['width']])) 105 | { 106 | crsl.upDateOnWindowResize = true; 107 | crsl.primarySizePercentage = opts[opts.d['width']]; 108 | opts[opts.d['width']] = ms_getPercentage(avail_primary, crsl.primarySizePercentage); 109 | if (!opts.items.visible) 110 | { 111 | opts.items.visibleConf.variable = true; 112 | } 113 | } 114 | 115 | if (opts.responsive) 116 | { 117 | opts.usePadding = false; 118 | opts.padding = [0, 0, 0, 0]; 119 | opts.align = false; 120 | opts.items.visibleConf.variable = false; 121 | } 122 | else 123 | { 124 | // visible-items not set 125 | if (!opts.items.visible) 126 | { 127 | opts = in_complementVisibleItems(opts, avail_primary); 128 | } 129 | 130 | // primary size not set -> calculate it or set to "variable" 131 | if (!opts[opts.d['width']]) 132 | { 133 | if (!opts.items.visibleConf.variable && is_number(opts.items[opts.d['width']]) && opts.items.filter == '*') 134 | { 135 | opts[opts.d['width']] = opts.items.visible * opts.items[opts.d['width']]; 136 | opts.align = false; 137 | } 138 | else 139 | { 140 | opts[opts.d['width']] = 'variable'; 141 | } 142 | } 143 | // align not set -> set to center if primary size is number 144 | if (is_undefined(opts.align)) 145 | { 146 | opts.align = (is_number(opts[opts.d['width']])) 147 | ? 'center' 148 | : false; 149 | } 150 | // set variabe visible-items 151 | if (opts.items.visibleConf.variable) 152 | { 153 | opts.items.visible = gn_getVisibleItemsNext(a_itm, opts, 0); 154 | } 155 | } 156 | 157 | // set visible items by filter 158 | if (opts.items.filter != '*' && !opts.items.visibleConf.variable) 159 | { 160 | opts.items.visibleConf.org = opts.items.visible; 161 | opts.items.visible = gn_getVisibleItemsNextFilter(a_itm, opts, 0); 162 | } 163 | 164 | opts.items.visible = cf_getItemsAdjust(opts.items.visible, opts, opts.items.visibleConf.adjust, $tt0); 165 | opts.items.visibleConf.old = opts.items.visible; 166 | 167 | if (opts.responsive) 168 | { 169 | if (!opts.items.visibleConf.min) 170 | { 171 | opts.items.visibleConf.min = opts.items.visible; 172 | } 173 | if (!opts.items.visibleConf.max) 174 | { 175 | opts.items.visibleConf.max = opts.items.visible; 176 | } 177 | opts = in_getResponsiveValues(opts, a_itm, avail_primary); 178 | } 179 | else 180 | { 181 | opts.padding = cf_getPadding(opts.padding); 182 | 183 | if (opts.align == 'top') 184 | { 185 | opts.align = 'left'; 186 | } 187 | else if (opts.align == 'bottom') 188 | { 189 | opts.align = 'right'; 190 | } 191 | 192 | switch (opts.align) 193 | { 194 | // align: center, left or right 195 | case 'center': 196 | case 'left': 197 | case 'right': 198 | if (opts[opts.d['width']] != 'variable') 199 | { 200 | opts = in_getAlignPadding(opts, a_itm); 201 | opts.usePadding = true; 202 | } 203 | break; 204 | 205 | // padding 206 | default: 207 | opts.align = false; 208 | opts.usePadding = ( 209 | opts.padding[0] == 0 && 210 | opts.padding[1] == 0 && 211 | opts.padding[2] == 0 && 212 | opts.padding[3] == 0 213 | ) ? false : true; 214 | break; 215 | } 216 | } 217 | 218 | if (!is_number(opts.scroll.duration)) 219 | { 220 | opts.scroll.duration = 500; 221 | } 222 | if (is_undefined(opts.scroll.items)) 223 | { 224 | opts.scroll.items = (opts.responsive || opts.items.visibleConf.variable || opts.items.filter != '*') 225 | ? 'visible' 226 | : opts.items.visible; 227 | } 228 | 229 | opts.auto = $.extend(true, {}, opts.scroll, opts.auto); 230 | opts.prev = $.extend(true, {}, opts.scroll, opts.prev); 231 | opts.next = $.extend(true, {}, opts.scroll, opts.next); 232 | opts.pagination = $.extend(true, {}, opts.scroll, opts.pagination); 233 | // swipe and mousewheel extend later on, per direction 234 | 235 | opts.auto = go_complementAutoObject($tt0, opts.auto); 236 | opts.prev = go_complementPrevNextObject($tt0, opts.prev); 237 | opts.next = go_complementPrevNextObject($tt0, opts.next); 238 | opts.pagination = go_complementPaginationObject($tt0, opts.pagination); 239 | opts.swipe = go_complementSwipeObject($tt0, opts.swipe); 240 | opts.mousewheel = go_complementMousewheelObject($tt0, opts.mousewheel); 241 | 242 | if (opts.synchronise) 243 | { 244 | opts.synchronise = cf_getSynchArr(opts.synchronise); 245 | } 246 | 247 | 248 | // DEPRECATED 249 | if (opts.auto.onPauseStart) 250 | { 251 | opts.auto.onTimeoutStart = opts.auto.onPauseStart; 252 | deprecated('auto.onPauseStart', 'auto.onTimeoutStart'); 253 | } 254 | if (opts.auto.onPausePause) 255 | { 256 | opts.auto.onTimeoutPause = opts.auto.onPausePause; 257 | deprecated('auto.onPausePause', 'auto.onTimeoutPause'); 258 | } 259 | if (opts.auto.onPauseEnd) 260 | { 261 | opts.auto.onTimeoutEnd = opts.auto.onPauseEnd; 262 | deprecated('auto.onPauseEnd', 'auto.onTimeoutEnd'); 263 | } 264 | if (opts.auto.pauseDuration) 265 | { 266 | opts.auto.timeoutDuration = opts.auto.pauseDuration; 267 | deprecated('auto.pauseDuration', 'auto.timeoutDuration'); 268 | } 269 | // /DEPRECATED 270 | 271 | 272 | }; // /init 273 | 274 | 275 | FN._build = function() { 276 | $cfs.data('_cfs_isCarousel', true); 277 | 278 | var a_itm = $cfs.children(), 279 | orgCSS = in_mapCss($cfs, ['textAlign', 'float', 'position', 'top', 'right', 'bottom', 'left', 'zIndex', 'width', 'height', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft']), 280 | newPosition = 'relative'; 281 | 282 | switch (orgCSS.position) 283 | { 284 | case 'absolute': 285 | case 'fixed': 286 | newPosition = orgCSS.position; 287 | break; 288 | } 289 | 290 | if (conf.wrapper == 'parent') 291 | { 292 | sz_storeOrigCss($wrp); 293 | } 294 | else 295 | { 296 | $wrp.css(orgCSS); 297 | } 298 | $wrp.css({ 299 | 'overflow' : 'hidden', 300 | 'position' : newPosition 301 | }); 302 | 303 | sz_storeOrigCss($cfs); 304 | $cfs.data('_cfs_origCssZindex', orgCSS.zIndex); 305 | $cfs.css({ 306 | 'textAlign' : 'left', 307 | 'float' : 'none', 308 | 'position' : 'absolute', 309 | 'top' : 0, 310 | 'right' : 'auto', 311 | 'bottom' : 'auto', 312 | 'left' : 0, 313 | 'marginTop' : 0, 314 | 'marginRight' : 0, 315 | 'marginBottom' : 0, 316 | 'marginLeft' : 0 317 | }); 318 | 319 | sz_storeMargin(a_itm, opts); 320 | sz_storeOrigCss(a_itm); 321 | if (opts.responsive) 322 | { 323 | sz_setResponsiveSizes(opts, a_itm); 324 | } 325 | 326 | }; // /build 327 | 328 | 329 | FN._bind_events = function() { 330 | FN._unbind_events(); 331 | 332 | 333 | // stop event 334 | $cfs.bind(cf_e('stop', conf), function(e, imm) { 335 | e.stopPropagation(); 336 | 337 | // button 338 | if (!crsl.isStopped) 339 | { 340 | if (opts.auto.button) 341 | { 342 | opts.auto.button.addClass(cf_c('stopped', conf)); 343 | } 344 | } 345 | 346 | // set stopped 347 | crsl.isStopped = true; 348 | 349 | if (opts.auto.play) 350 | { 351 | opts.auto.play = false; 352 | $cfs.trigger(cf_e('pause', conf), imm); 353 | } 354 | return true; 355 | }); 356 | 357 | 358 | // finish event 359 | $cfs.bind(cf_e('finish', conf), function(e) { 360 | e.stopPropagation(); 361 | if (crsl.isScrolling) 362 | { 363 | sc_stopScroll(scrl); 364 | } 365 | return true; 366 | }); 367 | 368 | 369 | // pause event 370 | $cfs.bind(cf_e('pause', conf), function(e, imm, res) { 371 | e.stopPropagation(); 372 | tmrs = sc_clearTimers(tmrs); 373 | 374 | // immediately pause 375 | if (imm && crsl.isScrolling) 376 | { 377 | scrl.isStopped = true; 378 | var nst = getTime() - scrl.startTime; 379 | scrl.duration -= nst; 380 | if (scrl.pre) 381 | { 382 | scrl.pre.duration -= nst; 383 | } 384 | if (scrl.post) 385 | { 386 | scrl.post.duration -= nst; 387 | } 388 | sc_stopScroll(scrl, false); 389 | } 390 | 391 | // update remaining pause-time 392 | if (!crsl.isPaused && !crsl.isScrolling) 393 | { 394 | if (res) 395 | { 396 | tmrs.timePassed += getTime() - tmrs.startTime; 397 | } 398 | } 399 | 400 | // button 401 | if (!crsl.isPaused) 402 | { 403 | if (opts.auto.button) 404 | { 405 | opts.auto.button.addClass(cf_c('paused', conf)); 406 | } 407 | } 408 | 409 | // set paused 410 | crsl.isPaused = true; 411 | 412 | // pause pause callback 413 | if (opts.auto.onTimeoutPause) 414 | { 415 | var dur1 = opts.auto.timeoutDuration - tmrs.timePassed, 416 | perc = 100 - Math.ceil( dur1 * 100 / opts.auto.timeoutDuration ); 417 | 418 | opts.auto.onTimeoutPause.call($tt0, perc, dur1); 419 | } 420 | return true; 421 | }); 422 | 423 | 424 | // play event 425 | $cfs.bind(cf_e('play', conf), function(e, dir, del, res) { 426 | e.stopPropagation(); 427 | tmrs = sc_clearTimers(tmrs); 428 | 429 | // sort params 430 | var v = [dir, del, res], 431 | t = ['string', 'number', 'boolean'], 432 | a = cf_sortParams(v, t); 433 | 434 | dir = a[0]; 435 | del = a[1]; 436 | res = a[2]; 437 | 438 | if (dir != 'prev' && dir != 'next') 439 | { 440 | dir = crsl.direction; 441 | } 442 | if (!is_number(del)) 443 | { 444 | del = 0; 445 | } 446 | if (!is_boolean(res)) 447 | { 448 | res = false; 449 | } 450 | 451 | // stopped? 452 | if (res) 453 | { 454 | crsl.isStopped = false; 455 | opts.auto.play = true; 456 | } 457 | if (!opts.auto.play) 458 | { 459 | e.stopImmediatePropagation(); 460 | return debug(conf, 'Carousel stopped: Not scrolling.'); 461 | } 462 | 463 | // button 464 | if (crsl.isPaused) 465 | { 466 | if (opts.auto.button) 467 | { 468 | opts.auto.button.removeClass(cf_c('stopped', conf)); 469 | opts.auto.button.removeClass(cf_c('paused', conf)); 470 | } 471 | } 472 | 473 | // set playing 474 | crsl.isPaused = false; 475 | tmrs.startTime = getTime(); 476 | 477 | // timeout the scrolling 478 | var dur1 = opts.auto.timeoutDuration + del; 479 | dur2 = dur1 - tmrs.timePassed; 480 | perc = 100 - Math.ceil(dur2 * 100 / dur1); 481 | 482 | if (opts.auto.progress) 483 | { 484 | tmrs.progress = setInterval(function() { 485 | var pasd = getTime() - tmrs.startTime + tmrs.timePassed, 486 | perc = Math.ceil(pasd * 100 / dur1); 487 | opts.auto.progress.updater.call(opts.auto.progress.bar[0], perc); 488 | }, opts.auto.progress.interval); 489 | } 490 | 491 | tmrs.auto = setTimeout(function() { 492 | if (opts.auto.progress) 493 | { 494 | opts.auto.progress.updater.call(opts.auto.progress.bar[0], 100); 495 | } 496 | if (opts.auto.onTimeoutEnd) 497 | { 498 | opts.auto.onTimeoutEnd.call($tt0, perc, dur2); 499 | } 500 | if (crsl.isScrolling) 501 | { 502 | $cfs.trigger(cf_e('play', conf), dir); 503 | } 504 | else 505 | { 506 | $cfs.trigger(cf_e(dir, conf), opts.auto); 507 | } 508 | }, dur2); 509 | 510 | // pause start callback 511 | if (opts.auto.onTimeoutStart) 512 | { 513 | opts.auto.onTimeoutStart.call($tt0, perc, dur2); 514 | } 515 | 516 | return true; 517 | }); 518 | 519 | 520 | // resume event 521 | $cfs.bind(cf_e('resume', conf), function(e) { 522 | e.stopPropagation(); 523 | if (scrl.isStopped) 524 | { 525 | scrl.isStopped = false; 526 | crsl.isPaused = false; 527 | crsl.isScrolling = true; 528 | scrl.startTime = getTime(); 529 | sc_startScroll(scrl, conf); 530 | } 531 | else 532 | { 533 | $cfs.trigger(cf_e('play', conf)); 534 | } 535 | return true; 536 | }); 537 | 538 | 539 | // prev + next events 540 | $cfs.bind(cf_e('prev', conf)+' '+cf_e('next', conf), function(e, obj, num, clb, que) { 541 | e.stopPropagation(); 542 | 543 | // stopped or hidden carousel, don't scroll, don't queue 544 | if (crsl.isStopped || $cfs.is(':hidden')) 545 | { 546 | e.stopImmediatePropagation(); 547 | return debug(conf, 'Carousel stopped or hidden: Not scrolling.'); 548 | } 549 | 550 | // not enough items 551 | var minimum = (is_number(opts.items.minimum)) ? opts.items.minimum : opts.items.visible + 1; 552 | if (minimum > itms.total) 553 | { 554 | e.stopImmediatePropagation(); 555 | return debug(conf, 'Not enough items ('+itms.total+' total, '+minimum+' needed): Not scrolling.'); 556 | } 557 | 558 | // get config 559 | var v = [obj, num, clb, que], 560 | t = ['object', 'number/string', 'function', 'boolean'], 561 | a = cf_sortParams(v, t); 562 | 563 | obj = a[0]; 564 | num = a[1]; 565 | clb = a[2]; 566 | que = a[3]; 567 | 568 | var eType = e.type.slice(conf.events.prefix.length); 569 | 570 | if (!is_object(obj)) 571 | { 572 | obj = {}; 573 | } 574 | if (is_function(clb)) 575 | { 576 | obj.onAfter = clb; 577 | } 578 | if (is_boolean(que)) 579 | { 580 | obj.queue = que; 581 | } 582 | obj = $.extend(true, {}, opts[eType], obj); 583 | 584 | // test conditions callback 585 | if (obj.conditions && !obj.conditions.call($tt0, eType)) 586 | { 587 | e.stopImmediatePropagation(); 588 | return debug(conf, 'Callback "conditions" returned false.'); 589 | } 590 | 591 | if (!is_number(num)) 592 | { 593 | if (opts.items.filter != '*') 594 | { 595 | num = 'visible'; 596 | } 597 | else 598 | { 599 | var arr = [num, obj.items, opts[eType].items]; 600 | for (var a = 0, l = arr.length; a < l; a++) 601 | { 602 | if (is_number(arr[a]) || arr[a] == 'page' || arr[a] == 'visible') { 603 | num = arr[a]; 604 | break; 605 | } 606 | } 607 | } 608 | switch(num) { 609 | case 'page': 610 | e.stopImmediatePropagation(); 611 | return $cfs.triggerHandler(cf_e(eType+'Page', conf), [obj, clb]); 612 | break; 613 | 614 | case 'visible': 615 | if (!opts.items.visibleConf.variable && opts.items.filter == '*') 616 | { 617 | num = opts.items.visible; 618 | } 619 | break; 620 | } 621 | } 622 | 623 | // resume animation, add current to queue 624 | if (scrl.isStopped) 625 | { 626 | $cfs.trigger(cf_e('resume', conf)); 627 | $cfs.trigger(cf_e('queue', conf), [eType, [obj, num, clb]]); 628 | e.stopImmediatePropagation(); 629 | return debug(conf, 'Carousel resumed scrolling.'); 630 | } 631 | 632 | // queue if scrolling 633 | if (obj.duration > 0) 634 | { 635 | if (crsl.isScrolling) 636 | { 637 | if (obj.queue) 638 | { 639 | if (obj.queue == 'last') 640 | { 641 | queu = []; 642 | } 643 | if (obj.queue != 'first' || queu.length == 0) 644 | { 645 | $cfs.trigger(cf_e('queue', conf), [eType, [obj, num, clb]]); 646 | } 647 | } 648 | e.stopImmediatePropagation(); 649 | return debug(conf, 'Carousel currently scrolling.'); 650 | } 651 | } 652 | 653 | tmrs.timePassed = 0; 654 | $cfs.trigger(cf_e('slide_'+eType, conf), [obj, num]); 655 | 656 | // synchronise 657 | if (opts.synchronise) 658 | { 659 | var s = opts.synchronise, 660 | c = [obj, num]; 661 | 662 | for (var j = 0, l = s.length; j < l; j++) { 663 | var d = eType; 664 | if (!s[j][2]) 665 | { 666 | d = (d == 'prev') ? 'next' : 'prev'; 667 | } 668 | if (!s[j][1]) 669 | { 670 | c[0] = s[j][0].triggerHandler('_cfs_triggerEvent', ['configuration', d]); 671 | } 672 | c[1] = num + s[j][3]; 673 | s[j][0].trigger('_cfs_triggerEvent', ['slide_'+d, c]); 674 | } 675 | } 676 | return true; 677 | }); 678 | 679 | 680 | // prev event 681 | $cfs.bind(cf_e('slide_prev', conf), function(e, sO, nI) { 682 | e.stopPropagation(); 683 | var a_itm = $cfs.children(); 684 | 685 | // non-circular at start, scroll to end 686 | if (!opts.circular) 687 | { 688 | if (itms.first == 0) 689 | { 690 | if (opts.infinite) 691 | { 692 | $cfs.trigger(cf_e('next', conf), itms.total-1); 693 | } 694 | return e.stopImmediatePropagation(); 695 | } 696 | } 697 | 698 | sz_resetMargin(a_itm, opts); 699 | 700 | // find number of items to scroll 701 | if (!is_number(nI)) 702 | { 703 | if (opts.items.visibleConf.variable) 704 | { 705 | nI = gn_getVisibleItemsPrev(a_itm, opts, itms.total-1); 706 | } 707 | else if (opts.items.filter != '*') 708 | { 709 | var xI = (is_number(sO.items)) ? sO.items : gn_getVisibleOrg($cfs, opts); 710 | nI = gn_getScrollItemsPrevFilter(a_itm, opts, itms.total-1, xI); 711 | } 712 | else 713 | { 714 | nI = opts.items.visible; 715 | } 716 | nI = cf_getAdjust(nI, opts, sO.items, $tt0); 717 | } 718 | 719 | // prevent non-circular from scrolling to far 720 | if (!opts.circular) 721 | { 722 | if (itms.total - nI < itms.first) 723 | { 724 | nI = itms.total - itms.first; 725 | } 726 | } 727 | 728 | // set new number of visible items 729 | opts.items.visibleConf.old = opts.items.visible; 730 | if (opts.items.visibleConf.variable) 731 | { 732 | var vI = cf_getItemsAdjust(gn_getVisibleItemsNext(a_itm, opts, itms.total-nI), opts, opts.items.visibleConf.adjust, $tt0); 733 | if (opts.items.visible+nI <= vI && nI < itms.total) 734 | { 735 | nI++; 736 | vI = cf_getItemsAdjust(gn_getVisibleItemsNext(a_itm, opts, itms.total-nI), opts, opts.items.visibleConf.adjust, $tt0); 737 | } 738 | opts.items.visible = vI; 739 | } 740 | else if (opts.items.filter != '*') 741 | { 742 | var vI = gn_getVisibleItemsNextFilter(a_itm, opts, itms.total-nI); 743 | opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0); 744 | } 745 | 746 | sz_resetMargin(a_itm, opts, true); 747 | 748 | // scroll 0, don't scroll 749 | if (nI == 0) 750 | { 751 | e.stopImmediatePropagation(); 752 | return debug(conf, '0 items to scroll: Not scrolling.'); 753 | } 754 | debug(conf, 'Scrolling '+nI+' items backward.'); 755 | 756 | 757 | // save new config 758 | itms.first += nI; 759 | while (itms.first >= itms.total) 760 | { 761 | itms.first -= itms.total; 762 | } 763 | 764 | // non-circular callback 765 | if (!opts.circular) 766 | { 767 | if (itms.first == 0 && sO.onEnd) 768 | { 769 | sO.onEnd.call($tt0, 'prev'); 770 | } 771 | if (!opts.infinite) 772 | { 773 | nv_enableNavi(opts, itms.first, conf); 774 | } 775 | } 776 | 777 | // rearrange items 778 | $cfs.children().slice(itms.total-nI, itms.total).prependTo($cfs); 779 | if (itms.total < opts.items.visible + nI) 780 | { 781 | $cfs.children().slice(0, (opts.items.visible+nI)-itms.total).clone(true).appendTo($cfs); 782 | } 783 | 784 | // the needed items 785 | var a_itm = $cfs.children(), 786 | i_old = gi_getOldItemsPrev(a_itm, opts, nI), 787 | i_new = gi_getNewItemsPrev(a_itm, opts), 788 | i_cur_l = a_itm.eq(nI-1), 789 | i_old_l = i_old.last(), 790 | i_new_l = i_new.last(); 791 | 792 | sz_resetMargin(a_itm, opts); 793 | 794 | var pL = 0, 795 | pR = 0; 796 | 797 | if (opts.align) 798 | { 799 | var p = cf_getAlignPadding(i_new, opts); 800 | pL = p[0]; 801 | pR = p[1]; 802 | } 803 | var oL = (pL < 0) ? opts.padding[opts.d[3]] : 0; 804 | 805 | // hide items for fx directscroll 806 | var hiddenitems = false, 807 | i_skp = $(); 808 | if (opts.items.visible < nI) 809 | { 810 | i_skp = a_itm.slice(opts.items.visibleConf.old, nI); 811 | if (sO.fx == 'directscroll') 812 | { 813 | var orgW = opts.items[opts.d['width']]; 814 | hiddenitems = i_skp; 815 | i_cur_l = i_new_l; 816 | sc_hideHiddenItems(hiddenitems); 817 | opts.items[opts.d['width']] = 'variable'; 818 | } 819 | } 820 | 821 | // save new sizes 822 | var $cf2 = false, 823 | i_siz = ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'), 824 | w_siz = cf_mapWrapperSizes(ms_getSizes(i_new, opts, true), opts, !opts.usePadding), 825 | i_siz_vis = 0, 826 | a_cfs = {}, 827 | a_wsz = {}, 828 | a_cur = {}, 829 | a_old = {}, 830 | a_new = {}, 831 | a_lef = {}, 832 | a_lef_vis = {}, 833 | a_dur = sc_getDuration(sO, opts, nI, i_siz); 834 | 835 | switch(sO.fx) 836 | { 837 | case 'cover': 838 | case 'cover-fade': 839 | i_siz_vis = ms_getTotalSize(a_itm.slice(0, opts.items.visible), opts, 'width'); 840 | break; 841 | } 842 | 843 | if (hiddenitems) 844 | { 845 | opts.items[opts.d['width']] = orgW; 846 | } 847 | 848 | sz_resetMargin(a_itm, opts, true); 849 | if (pR >= 0) 850 | { 851 | sz_resetMargin(i_old_l, opts, opts.padding[opts.d[1]]); 852 | } 853 | if (pL >= 0) 854 | { 855 | sz_resetMargin(i_cur_l, opts, opts.padding[opts.d[3]]); 856 | } 857 | 858 | if (opts.align) 859 | { 860 | opts.padding[opts.d[1]] = pR; 861 | opts.padding[opts.d[3]] = pL; 862 | } 863 | 864 | a_lef[opts.d['left']] = -(i_siz - oL); 865 | a_lef_vis[opts.d['left']] = -(i_siz_vis - oL); 866 | a_wsz[opts.d['left']] = w_siz[opts.d['width']]; 867 | 868 | // scrolling functions 869 | var _s_wrapper = function() {}, 870 | _a_wrapper = function() {}, 871 | _s_paddingold = function() {}, 872 | _a_paddingold = function() {}, 873 | _s_paddingnew = function() {}, 874 | _a_paddingnew = function() {}, 875 | _s_paddingcur = function() {}, 876 | _a_paddingcur = function() {}, 877 | _onafter = function() {}, 878 | _moveitems = function() {}, 879 | _position = function() {}; 880 | 881 | // clone carousel 882 | switch(sO.fx) 883 | { 884 | case 'crossfade': 885 | case 'cover': 886 | case 'cover-fade': 887 | case 'uncover': 888 | case 'uncover-fade': 889 | $cf2 = $cfs.clone(true).appendTo($wrp); 890 | break; 891 | } 892 | switch(sO.fx) 893 | { 894 | case 'crossfade': 895 | case 'uncover': 896 | case 'uncover-fade': 897 | $cf2.children().slice(0, nI).remove(); 898 | $cf2.children().slice(opts.items.visibleConf.old).remove(); 899 | break; 900 | 901 | case 'cover': 902 | case 'cover-fade': 903 | $cf2.children().slice(opts.items.visible).remove(); 904 | $cf2.css(a_lef_vis); 905 | break; 906 | } 907 | 908 | $cfs.css(a_lef); 909 | 910 | // reset all scrolls 911 | scrl = sc_setScroll(a_dur, sO.easing, conf); 912 | 913 | // animate / set carousel 914 | a_cfs[opts.d['left']] = (opts.usePadding) ? opts.padding[opts.d[3]] : 0; 915 | 916 | // animate / set wrapper 917 | if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable') 918 | { 919 | _s_wrapper = function() { 920 | $wrp.css(w_siz); 921 | }; 922 | _a_wrapper = function() { 923 | scrl.anims.push([$wrp, w_siz]); 924 | }; 925 | } 926 | 927 | // animate / set items 928 | if (opts.usePadding) 929 | { 930 | if (i_new_l.not(i_cur_l).length) 931 | { 932 | a_cur[opts.d['marginRight']] = i_cur_l.data('_cfs_origCssMargin'); 933 | 934 | if (pL < 0) 935 | { 936 | i_cur_l.css(a_cur); 937 | } 938 | else 939 | { 940 | _s_paddingcur = function() { 941 | i_cur_l.css(a_cur); 942 | }; 943 | _a_paddingcur = function() { 944 | scrl.anims.push([i_cur_l, a_cur]); 945 | }; 946 | } 947 | } 948 | switch(sO.fx) 949 | { 950 | case 'cover': 951 | case 'cover-fade': 952 | $cf2.children().eq(nI-1).css(a_cur); 953 | break; 954 | } 955 | 956 | if (i_new_l.not(i_old_l).length) 957 | { 958 | a_old[opts.d['marginRight']] = i_old_l.data('_cfs_origCssMargin'); 959 | _s_paddingold = function() { 960 | i_old_l.css(a_old); 961 | }; 962 | _a_paddingold = function() { 963 | scrl.anims.push([i_old_l, a_old]); 964 | }; 965 | } 966 | 967 | if (pR >= 0) 968 | { 969 | a_new[opts.d['marginRight']] = i_new_l.data('_cfs_origCssMargin') + opts.padding[opts.d[1]]; 970 | _s_paddingnew = function() { 971 | i_new_l.css(a_new); 972 | }; 973 | _a_paddingnew = function() { 974 | scrl.anims.push([i_new_l, a_new]); 975 | }; 976 | } 977 | } 978 | 979 | // set position 980 | _position = function() { 981 | $cfs.css(a_cfs); 982 | }; 983 | 984 | 985 | var overFill = opts.items.visible+nI-itms.total; 986 | 987 | // rearrange items 988 | _moveitems = function() { 989 | if (overFill > 0) 990 | { 991 | $cfs.children().slice(itms.total).remove(); 992 | i_old = $( $cfs.children().slice(itms.total-(opts.items.visible-overFill)).get().concat( $cfs.children().slice(0, overFill).get() ) ); 993 | } 994 | sc_showHiddenItems(hiddenitems); 995 | 996 | if (opts.usePadding) 997 | { 998 | var l_itm = $cfs.children().eq(opts.items.visible+nI-1); 999 | l_itm.css(opts.d['marginRight'], l_itm.data('_cfs_origCssMargin')); 1000 | } 1001 | }; 1002 | 1003 | 1004 | var cb_arguments = sc_mapCallbackArguments(i_old, i_skp, i_new, nI, 'prev', a_dur, w_siz); 1005 | 1006 | // fire onAfter callbacks 1007 | _onafter = function() { 1008 | sc_afterScroll($cfs, $cf2, sO); 1009 | crsl.isScrolling = false; 1010 | clbk.onAfter = sc_fireCallbacks($tt0, sO, 'onAfter', cb_arguments, clbk); 1011 | queu = sc_fireQueue($cfs, queu, conf); 1012 | 1013 | if (!crsl.isPaused) 1014 | { 1015 | $cfs.trigger(cf_e('play', conf)); 1016 | } 1017 | }; 1018 | 1019 | // fire onBefore callback 1020 | crsl.isScrolling = true; 1021 | tmrs = sc_clearTimers(tmrs); 1022 | clbk.onBefore = sc_fireCallbacks($tt0, sO, 'onBefore', cb_arguments, clbk); 1023 | 1024 | switch(sO.fx) 1025 | { 1026 | case 'none': 1027 | $cfs.css(a_cfs); 1028 | _s_wrapper(); 1029 | _s_paddingold(); 1030 | _s_paddingnew(); 1031 | _s_paddingcur(); 1032 | _position(); 1033 | _moveitems(); 1034 | _onafter(); 1035 | break; 1036 | 1037 | case 'fade': 1038 | scrl.anims.push([$cfs, { 'opacity': 0 }, function() { 1039 | _s_wrapper(); 1040 | _s_paddingold(); 1041 | _s_paddingnew(); 1042 | _s_paddingcur(); 1043 | _position(); 1044 | _moveitems(); 1045 | scrl = sc_setScroll(a_dur, sO.easing, conf); 1046 | scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]); 1047 | sc_startScroll(scrl, conf); 1048 | }]); 1049 | break; 1050 | 1051 | case 'crossfade': 1052 | $cfs.css({ 'opacity': 0 }); 1053 | scrl.anims.push([$cf2, { 'opacity': 0 }]); 1054 | scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]); 1055 | _a_wrapper(); 1056 | _s_paddingold(); 1057 | _s_paddingnew(); 1058 | _s_paddingcur(); 1059 | _position(); 1060 | _moveitems(); 1061 | break; 1062 | 1063 | case 'cover': 1064 | scrl.anims.push([$cf2, a_cfs, function() { 1065 | _s_paddingold(); 1066 | _s_paddingnew(); 1067 | _s_paddingcur(); 1068 | _position(); 1069 | _moveitems(); 1070 | _onafter(); 1071 | }]); 1072 | _a_wrapper(); 1073 | break; 1074 | 1075 | case 'cover-fade': 1076 | scrl.anims.push([$cfs, { 'opacity': 0 }]); 1077 | scrl.anims.push([$cf2, a_cfs, function() { 1078 | _s_paddingold(); 1079 | _s_paddingnew(); 1080 | _s_paddingcur(); 1081 | _position(); 1082 | _moveitems(); 1083 | _onafter(); 1084 | }]); 1085 | _a_wrapper(); 1086 | break; 1087 | 1088 | case 'uncover': 1089 | scrl.anims.push([$cf2, a_wsz, _onafter]); 1090 | _a_wrapper(); 1091 | _s_paddingold(); 1092 | _s_paddingnew(); 1093 | _s_paddingcur(); 1094 | _position(); 1095 | _moveitems(); 1096 | break; 1097 | 1098 | case 'uncover-fade': 1099 | $cfs.css({ 'opacity': 0 }); 1100 | scrl.anims.push([$cfs, { 'opacity': 1 }]); 1101 | scrl.anims.push([$cf2, a_wsz, _onafter]); 1102 | _a_wrapper(); 1103 | _s_paddingold(); 1104 | _s_paddingnew(); 1105 | _s_paddingcur(); 1106 | _position(); 1107 | _moveitems(); 1108 | break; 1109 | 1110 | default: 1111 | scrl.anims.push([$cfs, a_cfs, function() { 1112 | _moveitems(); 1113 | _onafter(); 1114 | }]); 1115 | _a_wrapper(); 1116 | _a_paddingold(); 1117 | _a_paddingnew(); 1118 | _a_paddingcur(); 1119 | break; 1120 | } 1121 | 1122 | sc_startScroll(scrl, conf); 1123 | cf_setCookie(opts.cookie, $cfs, conf); 1124 | 1125 | $cfs.trigger(cf_e('updatePageStatus', conf), [false, w_siz]); 1126 | 1127 | return true; 1128 | }); 1129 | 1130 | 1131 | // next event 1132 | $cfs.bind(cf_e('slide_next', conf), function(e, sO, nI) { 1133 | e.stopPropagation(); 1134 | var a_itm = $cfs.children(); 1135 | 1136 | // non-circular at end, scroll to start 1137 | if (!opts.circular) 1138 | { 1139 | if (itms.first == opts.items.visible) 1140 | { 1141 | if (opts.infinite) 1142 | { 1143 | $cfs.trigger(cf_e('prev', conf), itms.total-1); 1144 | } 1145 | return e.stopImmediatePropagation(); 1146 | } 1147 | } 1148 | 1149 | sz_resetMargin(a_itm, opts); 1150 | 1151 | // find number of items to scroll 1152 | if (!is_number(nI)) 1153 | { 1154 | if (opts.items.filter != '*') 1155 | { 1156 | var xI = (is_number(sO.items)) ? sO.items : gn_getVisibleOrg($cfs, opts); 1157 | nI = gn_getScrollItemsNextFilter(a_itm, opts, 0, xI); 1158 | } 1159 | else 1160 | { 1161 | nI = opts.items.visible; 1162 | } 1163 | nI = cf_getAdjust(nI, opts, sO.items, $tt0); 1164 | } 1165 | 1166 | var lastItemNr = (itms.first == 0) ? itms.total : itms.first; 1167 | 1168 | // prevent non-circular from scrolling to far 1169 | if (!opts.circular) 1170 | { 1171 | if (opts.items.visibleConf.variable) 1172 | { 1173 | var vI = gn_getVisibleItemsNext(a_itm, opts, nI), 1174 | xI = gn_getVisibleItemsPrev(a_itm, opts, lastItemNr-1); 1175 | } 1176 | else 1177 | { 1178 | var vI = opts.items.visible, 1179 | xI = opts.items.visible; 1180 | } 1181 | 1182 | if (nI + vI > lastItemNr) 1183 | { 1184 | nI = lastItemNr - xI; 1185 | } 1186 | } 1187 | 1188 | // set new number of visible items 1189 | opts.items.visibleConf.old = opts.items.visible; 1190 | if (opts.items.visibleConf.variable) 1191 | { 1192 | var vI = cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr), opts, opts.items.visibleConf.adjust, $tt0); 1193 | while (opts.items.visible-nI >= vI && nI < itms.total) 1194 | { 1195 | nI++; 1196 | vI = cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr), opts, opts.items.visibleConf.adjust, $tt0); 1197 | } 1198 | opts.items.visible = vI; 1199 | } 1200 | else if (opts.items.filter != '*') 1201 | { 1202 | var vI = gn_getVisibleItemsNextFilter(a_itm, opts, nI); 1203 | opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0); 1204 | } 1205 | 1206 | sz_resetMargin(a_itm, opts, true); 1207 | 1208 | // scroll 0, don't scroll 1209 | if (nI == 0) 1210 | { 1211 | e.stopImmediatePropagation(); 1212 | return debug(conf, '0 items to scroll: Not scrolling.'); 1213 | } 1214 | debug(conf, 'Scrolling '+nI+' items forward.'); 1215 | 1216 | 1217 | // save new config 1218 | itms.first -= nI; 1219 | while (itms.first < 0) 1220 | { 1221 | itms.first += itms.total; 1222 | } 1223 | 1224 | // non-circular callback 1225 | if (!opts.circular) 1226 | { 1227 | if (itms.first == opts.items.visible && sO.onEnd) 1228 | { 1229 | sO.onEnd.call($tt0, 'next'); 1230 | } 1231 | if (!opts.infinite) 1232 | { 1233 | nv_enableNavi(opts, itms.first, conf); 1234 | } 1235 | } 1236 | 1237 | // rearrange items 1238 | if (itms.total < opts.items.visible+nI) 1239 | { 1240 | $cfs.children().slice(0, (opts.items.visible+nI)-itms.total).clone(true).appendTo($cfs); 1241 | } 1242 | 1243 | // the needed items 1244 | var a_itm = $cfs.children(), 1245 | i_old = gi_getOldItemsNext(a_itm, opts), 1246 | i_new = gi_getNewItemsNext(a_itm, opts, nI), 1247 | i_cur_l = a_itm.eq(nI-1), 1248 | i_old_l = i_old.last(), 1249 | i_new_l = i_new.last(); 1250 | 1251 | sz_resetMargin(a_itm, opts); 1252 | 1253 | var pL = 0, 1254 | pR = 0; 1255 | 1256 | if (opts.align) 1257 | { 1258 | var p = cf_getAlignPadding(i_new, opts); 1259 | pL = p[0]; 1260 | pR = p[1]; 1261 | } 1262 | 1263 | // hide items for fx directscroll 1264 | var hiddenitems = false, 1265 | i_skp = $(); 1266 | if (opts.items.visibleConf.old < nI) 1267 | { 1268 | i_skp = a_itm.slice(opts.items.visibleConf.old, nI); 1269 | if (sO.fx == 'directscroll') 1270 | { 1271 | var orgW = opts.items[opts.d['width']]; 1272 | hiddenitems = i_skp; 1273 | i_cur_l = i_old_l; 1274 | sc_hideHiddenItems(hiddenitems); 1275 | opts.items[opts.d['width']] = 'variable'; 1276 | } 1277 | } 1278 | 1279 | // save new sizes 1280 | var $cf2 = false, 1281 | i_siz = ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'), 1282 | w_siz = cf_mapWrapperSizes(ms_getSizes(i_new, opts, true), opts, !opts.usePadding), 1283 | i_siz_vis = 0, 1284 | a_cfs = {}, 1285 | a_cfs_vis = {}, 1286 | a_cur = {}, 1287 | a_old = {}, 1288 | a_lef = {}, 1289 | a_dur = sc_getDuration(sO, opts, nI, i_siz); 1290 | 1291 | switch(sO.fx) 1292 | { 1293 | case 'uncover': 1294 | case 'uncover-fade': 1295 | i_siz_vis = ms_getTotalSize(a_itm.slice(0, opts.items.visibleConf.old), opts, 'width'); 1296 | break; 1297 | } 1298 | 1299 | if (hiddenitems) 1300 | { 1301 | opts.items[opts.d['width']] = orgW; 1302 | } 1303 | 1304 | if (opts.align) 1305 | { 1306 | if (opts.padding[opts.d[1]] < 0) 1307 | { 1308 | opts.padding[opts.d[1]] = 0; 1309 | } 1310 | } 1311 | sz_resetMargin(a_itm, opts, true); 1312 | sz_resetMargin(i_old_l, opts, opts.padding[opts.d[1]]); 1313 | 1314 | if (opts.align) 1315 | { 1316 | opts.padding[opts.d[1]] = pR; 1317 | opts.padding[opts.d[3]] = pL; 1318 | } 1319 | 1320 | a_lef[opts.d['left']] = (opts.usePadding) ? opts.padding[opts.d[3]] : 0; 1321 | 1322 | // scrolling functions 1323 | var _s_wrapper = function() {}, 1324 | _a_wrapper = function() {}, 1325 | _s_paddingold = function() {}, 1326 | _a_paddingold = function() {}, 1327 | _s_paddingcur = function() {}, 1328 | _a_paddingcur = function() {}, 1329 | _onafter = function() {}, 1330 | _moveitems = function() {}, 1331 | _position = function() {}; 1332 | 1333 | // clone carousel 1334 | switch(sO.fx) 1335 | { 1336 | case 'crossfade': 1337 | case 'cover': 1338 | case 'cover-fade': 1339 | case 'uncover': 1340 | case 'uncover-fade': 1341 | $cf2 = $cfs.clone(true).appendTo($wrp); 1342 | $cf2.children().slice(opts.items.visibleConf.old).remove(); 1343 | break; 1344 | } 1345 | switch(sO.fx) 1346 | { 1347 | case 'crossfade': 1348 | case 'cover': 1349 | case 'cover-fade': 1350 | $cfs.css('zIndex', 1); 1351 | $cf2.css('zIndex', 0); 1352 | break; 1353 | } 1354 | 1355 | // reset all scrolls 1356 | scrl = sc_setScroll(a_dur, sO.easing, conf); 1357 | 1358 | // animate / set carousel 1359 | a_cfs[opts.d['left']] = -i_siz; 1360 | a_cfs_vis[opts.d['left']] = -i_siz_vis; 1361 | 1362 | if (pL < 0) 1363 | { 1364 | a_cfs[opts.d['left']] += pL; 1365 | } 1366 | 1367 | // animate / set wrapper 1368 | if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable') 1369 | { 1370 | _s_wrapper = function() { 1371 | $wrp.css(w_siz); 1372 | }; 1373 | _a_wrapper = function() { 1374 | scrl.anims.push([$wrp, w_siz]); 1375 | }; 1376 | } 1377 | 1378 | // animate / set items 1379 | if (opts.usePadding) 1380 | { 1381 | var i_new_l_m = i_new_l.data('_cfs_origCssMargin'); 1382 | 1383 | if (pR >= 0) 1384 | { 1385 | i_new_l_m += opts.padding[opts.d[1]]; 1386 | } 1387 | i_new_l.css(opts.d['marginRight'], i_new_l_m); 1388 | 1389 | if (i_cur_l.not(i_old_l).length) 1390 | { 1391 | a_old[opts.d['marginRight']] = i_old_l.data('_cfs_origCssMargin'); 1392 | } 1393 | _s_paddingold = function() { 1394 | i_old_l.css(a_old); 1395 | }; 1396 | _a_paddingold = function() { 1397 | scrl.anims.push([i_old_l, a_old]); 1398 | }; 1399 | 1400 | var i_cur_l_m = i_cur_l.data('_cfs_origCssMargin'); 1401 | if (pL > 0) 1402 | { 1403 | i_cur_l_m += opts.padding[opts.d[3]]; 1404 | } 1405 | 1406 | a_cur[opts.d['marginRight']] = i_cur_l_m; 1407 | 1408 | _s_paddingcur = function() { 1409 | i_cur_l.css(a_cur); 1410 | }; 1411 | _a_paddingcur = function() { 1412 | scrl.anims.push([i_cur_l, a_cur]); 1413 | }; 1414 | } 1415 | 1416 | // set position 1417 | _position = function() { 1418 | $cfs.css(a_lef); 1419 | }; 1420 | 1421 | 1422 | var overFill = opts.items.visible+nI-itms.total; 1423 | 1424 | // rearrange items 1425 | _moveitems = function() { 1426 | if (overFill > 0) 1427 | { 1428 | $cfs.children().slice(itms.total).remove(); 1429 | } 1430 | var l_itm = $cfs.children().slice(0, nI).appendTo($cfs).last(); 1431 | if (overFill > 0) 1432 | { 1433 | i_new = gi_getCurrentItems(a_itm, opts); 1434 | } 1435 | sc_showHiddenItems(hiddenitems); 1436 | 1437 | if (opts.usePadding) 1438 | { 1439 | if (itms.total < opts.items.visible+nI) { 1440 | var i_cur_l = $cfs.children().eq(opts.items.visible-1); 1441 | i_cur_l.css(opts.d['marginRight'], i_cur_l.data('_cfs_origCssMargin') + opts.padding[opts.d[1]]); 1442 | } 1443 | l_itm.css(opts.d['marginRight'], l_itm.data('_cfs_origCssMargin')); 1444 | } 1445 | }; 1446 | 1447 | 1448 | var cb_arguments = sc_mapCallbackArguments(i_old, i_skp, i_new, nI, 'next', a_dur, w_siz); 1449 | 1450 | // fire onAfter callbacks 1451 | _onafter = function() { 1452 | $cfs.css('zIndex', $cfs.data('_cfs_origCssZindex')); 1453 | sc_afterScroll($cfs, $cf2, sO); 1454 | crsl.isScrolling = false; 1455 | clbk.onAfter = sc_fireCallbacks($tt0, sO, 'onAfter', cb_arguments, clbk); 1456 | queu = sc_fireQueue($cfs, queu, conf); 1457 | 1458 | if (!crsl.isPaused) 1459 | { 1460 | $cfs.trigger(cf_e('play', conf)); 1461 | } 1462 | }; 1463 | 1464 | // fire onBefore callbacks 1465 | crsl.isScrolling = true; 1466 | tmrs = sc_clearTimers(tmrs); 1467 | clbk.onBefore = sc_fireCallbacks($tt0, sO, 'onBefore', cb_arguments, clbk); 1468 | 1469 | switch(sO.fx) 1470 | { 1471 | case 'none': 1472 | $cfs.css(a_cfs); 1473 | _s_wrapper(); 1474 | _s_paddingold(); 1475 | _s_paddingcur(); 1476 | _position(); 1477 | _moveitems(); 1478 | _onafter(); 1479 | break; 1480 | 1481 | case 'fade': 1482 | scrl.anims.push([$cfs, { 'opacity': 0 }, function() { 1483 | _s_wrapper(); 1484 | _s_paddingold(); 1485 | _s_paddingcur(); 1486 | _position(); 1487 | _moveitems(); 1488 | scrl = sc_setScroll(a_dur, sO.easing, conf); 1489 | scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]); 1490 | sc_startScroll(scrl, conf); 1491 | }]); 1492 | break; 1493 | 1494 | case 'crossfade': 1495 | $cfs.css({ 'opacity': 0 }); 1496 | scrl.anims.push([$cf2, { 'opacity': 0 }]); 1497 | scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]); 1498 | _a_wrapper(); 1499 | _s_paddingold(); 1500 | _s_paddingcur(); 1501 | _position(); 1502 | _moveitems(); 1503 | break; 1504 | 1505 | case 'cover': 1506 | $cfs.css(opts.d['left'], $wrp[opts.d['width']]()); 1507 | scrl.anims.push([$cfs, a_lef, _onafter]); 1508 | _a_wrapper(); 1509 | _s_paddingold(); 1510 | _s_paddingcur(); 1511 | _moveitems(); 1512 | break; 1513 | 1514 | case 'cover-fade': 1515 | $cfs.css(opts.d['left'], $wrp[opts.d['width']]()); 1516 | scrl.anims.push([$cf2, { 'opacity': 0 }]); 1517 | scrl.anims.push([$cfs, a_lef, _onafter]); 1518 | _a_wrapper(); 1519 | _s_paddingold(); 1520 | _s_paddingcur(); 1521 | _moveitems(); 1522 | break; 1523 | 1524 | case 'uncover': 1525 | scrl.anims.push([$cf2, a_cfs_vis, _onafter]); 1526 | _a_wrapper(); 1527 | _s_paddingold(); 1528 | _s_paddingcur(); 1529 | _position(); 1530 | _moveitems(); 1531 | break; 1532 | 1533 | case 'uncover-fade': 1534 | $cfs.css({ 'opacity': 0 }); 1535 | scrl.anims.push([$cfs, { 'opacity': 1 }]); 1536 | scrl.anims.push([$cf2, a_cfs_vis, _onafter]); 1537 | _a_wrapper(); 1538 | _s_paddingold(); 1539 | _s_paddingcur(); 1540 | _position(); 1541 | _moveitems(); 1542 | break; 1543 | 1544 | default: 1545 | scrl.anims.push([$cfs, a_cfs, function() { 1546 | _position(); 1547 | _moveitems(); 1548 | _onafter(); 1549 | }]); 1550 | _a_wrapper(); 1551 | _a_paddingold(); 1552 | _a_paddingcur(); 1553 | break; 1554 | } 1555 | 1556 | sc_startScroll(scrl, conf); 1557 | cf_setCookie(opts.cookie, $cfs, conf); 1558 | 1559 | $cfs.trigger(cf_e('updatePageStatus', conf), [false, w_siz]); 1560 | 1561 | return true; 1562 | }); 1563 | 1564 | 1565 | // slideTo event 1566 | $cfs.bind(cf_e('slideTo', conf), function(e, num, dev, org, obj, dir, clb) { 1567 | e.stopPropagation(); 1568 | 1569 | var v = [num, dev, org, obj, dir, clb], 1570 | t = ['string/number/object', 'number', 'boolean', 'object', 'string', 'function'], 1571 | a = cf_sortParams(v, t); 1572 | 1573 | obj = a[3]; 1574 | dir = a[4]; 1575 | clb = a[5]; 1576 | 1577 | num = gn_getItemIndex(a[0], a[1], a[2], itms, $cfs); 1578 | 1579 | if (num == 0) 1580 | { 1581 | return false; 1582 | } 1583 | if (!is_object(obj)) 1584 | { 1585 | obj = false; 1586 | } 1587 | 1588 | if (dir != 'prev' && dir != 'next') 1589 | { 1590 | if (opts.circular) 1591 | { 1592 | dir = (num <= itms.total / 2) ? 'next' : 'prev'; 1593 | } 1594 | else 1595 | { 1596 | dir = (itms.first == 0 || itms.first > num) ? 'next' : 'prev'; 1597 | } 1598 | } 1599 | 1600 | if (dir == 'prev') 1601 | { 1602 | num = itms.total-num; 1603 | } 1604 | $cfs.trigger(cf_e(dir, conf), [obj, num, clb]); 1605 | 1606 | return true; 1607 | }); 1608 | 1609 | 1610 | // prevPage event 1611 | $cfs.bind(cf_e('prevPage', conf), function(e, obj, clb) { 1612 | e.stopPropagation(); 1613 | var cur = $cfs.triggerHandler(cf_e('currentPage', conf)); 1614 | return $cfs.triggerHandler(cf_e('slideToPage', conf), [cur-1, obj, 'prev', clb]); 1615 | }); 1616 | 1617 | 1618 | // nextPage event 1619 | $cfs.bind(cf_e('nextPage', conf), function(e, obj, clb) { 1620 | e.stopPropagation(); 1621 | var cur = $cfs.triggerHandler(cf_e('currentPage', conf)); 1622 | return $cfs.triggerHandler(cf_e('slideToPage', conf), [cur+1, obj, 'next', clb]); 1623 | }); 1624 | 1625 | 1626 | // slideToPage event 1627 | $cfs.bind(cf_e('slideToPage', conf), function(e, pag, obj, dir, clb) { 1628 | e.stopPropagation(); 1629 | if (!is_number(pag)) 1630 | { 1631 | pag = $cfs.triggerHandler(cf_e('currentPage', conf)); 1632 | } 1633 | var ipp = opts.pagination.items || opts.items.visible, 1634 | max = Math.ceil(itms.total / ipp)-1; 1635 | 1636 | if (pag < 0) 1637 | { 1638 | pag = max; 1639 | } 1640 | if (pag > max) 1641 | { 1642 | pag = 0; 1643 | } 1644 | return $cfs.triggerHandler(cf_e('slideTo', conf), [pag*ipp, 0, true, obj, dir, clb]); 1645 | }); 1646 | 1647 | // jumpToStart event 1648 | $cfs.bind(cf_e('jumpToStart', conf), function(e, s) { 1649 | e.stopPropagation(); 1650 | if (s) 1651 | { 1652 | s = gn_getItemIndex(s, 0, true, itms, $cfs); 1653 | } 1654 | else 1655 | { 1656 | s = 0; 1657 | } 1658 | 1659 | s += itms.first; 1660 | if (s != 0) 1661 | { 1662 | if (itms.total > 0) 1663 | { 1664 | while (s > itms.total) 1665 | { 1666 | s -= itms.total; 1667 | } 1668 | } 1669 | $cfs.prepend($cfs.children().slice(s, itms.total)); 1670 | } 1671 | return true; 1672 | }); 1673 | 1674 | 1675 | // synchronise event 1676 | $cfs.bind(cf_e('synchronise', conf), function(e, s) { 1677 | e.stopPropagation(); 1678 | if (s) 1679 | { 1680 | s = cf_getSynchArr(s); 1681 | } 1682 | else if (opts.synchronise) 1683 | { 1684 | s = opts.synchronise; 1685 | } 1686 | else 1687 | { 1688 | return debug(conf, 'No carousel to synchronise.'); 1689 | } 1690 | 1691 | var n = $cfs.triggerHandler(cf_e('currentPosition', conf)), 1692 | x = true; 1693 | 1694 | for (var j = 0, l = s.length; j < l; j++) 1695 | { 1696 | if (!s[j][0].triggerHandler(cf_e('slideTo', conf), [n, s[j][3], true])) 1697 | { 1698 | x = false; 1699 | } 1700 | } 1701 | return x; 1702 | }); 1703 | 1704 | 1705 | // queue event 1706 | $cfs.bind(cf_e('queue', conf), function(e, dir, opt) { 1707 | e.stopPropagation(); 1708 | if (is_function(dir)) 1709 | { 1710 | dir.call($tt0, queu); 1711 | } 1712 | else if (is_array(dir)) 1713 | { 1714 | queu = dir; 1715 | } 1716 | else if (!is_undefined(dir)) 1717 | { 1718 | queu.push([dir, opt]); 1719 | } 1720 | return queu; 1721 | }); 1722 | 1723 | 1724 | // insertItem event 1725 | $cfs.bind(cf_e('insertItem', conf), function(e, itm, num, org, dev) { 1726 | e.stopPropagation(); 1727 | 1728 | var v = [itm, num, org, dev], 1729 | t = ['string/object', 'string/number/object', 'boolean', 'number'], 1730 | a = cf_sortParams(v, t); 1731 | 1732 | itm = a[0]; 1733 | num = a[1]; 1734 | org = a[2]; 1735 | dev = a[3]; 1736 | 1737 | if (is_object(itm) && !is_jquery(itm)) 1738 | { 1739 | itm = $(itm); 1740 | } 1741 | else if (is_string(itm)) 1742 | { 1743 | itm = $(itm); 1744 | } 1745 | if (!is_jquery(itm) || itm.length == 0) 1746 | { 1747 | return debug(conf, 'Not a valid object.'); 1748 | } 1749 | 1750 | if (is_undefined(num)) 1751 | { 1752 | num = 'end'; 1753 | } 1754 | 1755 | sz_storeMargin(itm, opts); 1756 | sz_storeOrigCss(itm); 1757 | 1758 | var orgNum = num, 1759 | before = 'before'; 1760 | 1761 | if (num == 'end') 1762 | { 1763 | if (org) 1764 | { 1765 | if (itms.first == 0) 1766 | { 1767 | num = itms.total-1; 1768 | before = 'after'; 1769 | } 1770 | else 1771 | { 1772 | num = itms.first; 1773 | itms.first += itm.length; 1774 | } 1775 | if (num < 0) 1776 | { 1777 | num = 0; 1778 | } 1779 | } 1780 | else 1781 | { 1782 | num = itms.total-1; 1783 | before = 'after'; 1784 | } 1785 | } 1786 | else 1787 | { 1788 | num = gn_getItemIndex(num, dev, org, itms, $cfs); 1789 | } 1790 | 1791 | var $cit = $cfs.children().eq(num); 1792 | if ($cit.length) 1793 | { 1794 | $cit[before](itm); 1795 | } 1796 | else 1797 | { 1798 | debug(conf, 'Correct insert-position not found! Appending item to the end.'); 1799 | $cfs.append(itm); 1800 | } 1801 | 1802 | if (orgNum != 'end' && !org) 1803 | { 1804 | if (num < itms.first) 1805 | { 1806 | itms.first += itm.length; 1807 | } 1808 | } 1809 | itms.total = $cfs.children().length; 1810 | if (itms.first >= itms.total) 1811 | { 1812 | itms.first -= itms.total; 1813 | } 1814 | 1815 | $cfs.trigger(cf_e('updateSizes', conf)); 1816 | $cfs.trigger(cf_e('linkAnchors', conf)); 1817 | 1818 | return true; 1819 | }); 1820 | 1821 | 1822 | // removeItem event 1823 | $cfs.bind(cf_e('removeItem', conf), function(e, num, org, dev) { 1824 | e.stopPropagation(); 1825 | 1826 | var v = [num, org, dev], 1827 | t = ['string/number/object', 'boolean', 'number'], 1828 | a = cf_sortParams(v, t); 1829 | 1830 | num = a[0]; 1831 | org = a[1]; 1832 | dev = a[2]; 1833 | 1834 | var removed = false; 1835 | 1836 | if (num instanceof $ && num.length > 1) 1837 | { 1838 | $removed = $(); 1839 | num.each(function(i, el) { 1840 | var $rem = $cfs.trigger(cf_e('removeItem', conf), [$(this), org, dev]); 1841 | if ( $rem ) 1842 | { 1843 | $removed = $removed.add($rem); 1844 | } 1845 | }); 1846 | return $removed; 1847 | } 1848 | 1849 | if (is_undefined(num) || num == 'end') 1850 | { 1851 | $removed = $cfs.children().last(); 1852 | } 1853 | else 1854 | { 1855 | num = gn_getItemIndex(num, dev, org, itms, $cfs); 1856 | var $removed = $cfs.children().eq(num); 1857 | if ( $removed.length ) 1858 | { 1859 | if (num < itms.first) 1860 | { 1861 | itms.first -= $removed.length; 1862 | } 1863 | } 1864 | } 1865 | if ( $removed && $removed.length ) 1866 | { 1867 | $removed.detach(); 1868 | itms.total = $cfs.children().length; 1869 | $cfs.trigger(cf_e('updateSizes', conf)); 1870 | } 1871 | 1872 | return $removed; 1873 | }); 1874 | 1875 | 1876 | // onBefore and onAfter event 1877 | $cfs.bind(cf_e('onBefore', conf)+' '+cf_e('onAfter', conf), function(e, fn) { 1878 | e.stopPropagation(); 1879 | var eType = e.type.slice(conf.events.prefix.length); 1880 | if (is_array(fn)) 1881 | { 1882 | clbk[eType] = fn; 1883 | } 1884 | if (is_function(fn)) 1885 | { 1886 | clbk[eType].push(fn); 1887 | } 1888 | return clbk[eType]; 1889 | }); 1890 | 1891 | 1892 | // currentPosition event 1893 | $cfs.bind(cf_e('currentPosition', conf), function(e, fn) { 1894 | e.stopPropagation(); 1895 | if (itms.first == 0) 1896 | { 1897 | var val = 0; 1898 | } 1899 | else 1900 | { 1901 | var val = itms.total - itms.first; 1902 | } 1903 | if (is_function(fn)) 1904 | { 1905 | fn.call($tt0, val); 1906 | } 1907 | return val; 1908 | }); 1909 | 1910 | 1911 | // currentPage event 1912 | $cfs.bind(cf_e('currentPage', conf), function(e, fn) { 1913 | e.stopPropagation(); 1914 | var ipp = opts.pagination.items || opts.items.visible, 1915 | max = Math.ceil(itms.total/ipp-1), 1916 | nr; 1917 | if (itms.first == 0) 1918 | { 1919 | nr = 0; 1920 | } 1921 | else if (itms.first < itms.total % ipp) 1922 | { 1923 | nr = 0; 1924 | } 1925 | else if (itms.first == ipp && !opts.circular) 1926 | { 1927 | nr = max; 1928 | } 1929 | else 1930 | { 1931 | nr = Math.round((itms.total-itms.first)/ipp); 1932 | } 1933 | if (nr < 0) 1934 | { 1935 | nr = 0; 1936 | } 1937 | if (nr > max) 1938 | { 1939 | nr = max; 1940 | } 1941 | if (is_function(fn)) 1942 | { 1943 | fn.call($tt0, nr); 1944 | } 1945 | return nr; 1946 | }); 1947 | 1948 | 1949 | // currentVisible event 1950 | $cfs.bind(cf_e('currentVisible', conf), function(e, fn) { 1951 | e.stopPropagation(); 1952 | var $i = gi_getCurrentItems($cfs.children(), opts); 1953 | if (is_function(fn)) 1954 | { 1955 | fn.call($tt0, $i); 1956 | } 1957 | return $i; 1958 | }); 1959 | 1960 | 1961 | // slice event 1962 | $cfs.bind(cf_e('slice', conf), function(e, f, l, fn) { 1963 | e.stopPropagation(); 1964 | 1965 | if (itms.total == 0) 1966 | { 1967 | return false; 1968 | } 1969 | 1970 | var v = [f, l, fn], 1971 | t = ['number', 'number', 'function'], 1972 | a = cf_sortParams(v, t); 1973 | 1974 | f = (is_number(a[0])) ? a[0] : 0; 1975 | l = (is_number(a[1])) ? a[1] : itms.total; 1976 | fn = a[2]; 1977 | 1978 | f += itms.first; 1979 | l += itms.first; 1980 | 1981 | if (items.total > 0) 1982 | { 1983 | while (f > itms.total) 1984 | { 1985 | f -= itms.total; 1986 | } 1987 | while (l > itms.total) 1988 | { 1989 | l -= itms.total; 1990 | } 1991 | while (f < 0) 1992 | { 1993 | f += itms.total; 1994 | } 1995 | while (l < 0) 1996 | { 1997 | l += itms.total; 1998 | } 1999 | } 2000 | var $iA = $cfs.children(), 2001 | $i; 2002 | 2003 | if (l > f) 2004 | { 2005 | $i = $iA.slice(f, l); 2006 | } 2007 | else 2008 | { 2009 | $i = $( $iA.slice(f, itms.total).get().concat( $iA.slice(0, l).get() ) ); 2010 | } 2011 | 2012 | if (is_function(fn)) 2013 | { 2014 | fn.call($tt0, $i); 2015 | } 2016 | return $i; 2017 | }); 2018 | 2019 | 2020 | // isPaused, isStopped and isScrolling events 2021 | $cfs.bind(cf_e('isPaused', conf)+' '+cf_e('isStopped', conf)+' '+cf_e('isScrolling', conf), function(e, fn) { 2022 | e.stopPropagation(); 2023 | var eType = e.type.slice(conf.events.prefix.length), 2024 | value = crsl[eType]; 2025 | if (is_function(fn)) 2026 | { 2027 | fn.call($tt0, value); 2028 | } 2029 | return value; 2030 | }); 2031 | 2032 | 2033 | // configuration event 2034 | $cfs.bind(cf_e('configuration', conf), function(e, a, b, c) { 2035 | e.stopPropagation(); 2036 | var reInit = false; 2037 | 2038 | // return entire configuration-object 2039 | if (is_function(a)) 2040 | { 2041 | a.call($tt0, opts); 2042 | } 2043 | // set multiple options via object 2044 | else if (is_object(a)) 2045 | { 2046 | opts_orig = $.extend(true, {}, opts_orig, a); 2047 | if (b !== false) reInit = true; 2048 | else opts = $.extend(true, {}, opts, a); 2049 | 2050 | } 2051 | else if (!is_undefined(a)) 2052 | { 2053 | 2054 | // callback function for specific option 2055 | if (is_function(b)) 2056 | { 2057 | var val = eval('opts.'+a); 2058 | if (is_undefined(val)) 2059 | { 2060 | val = ''; 2061 | } 2062 | b.call($tt0, val); 2063 | } 2064 | // set individual option 2065 | else if (!is_undefined(b)) 2066 | { 2067 | if (typeof c !== 'boolean') c = true; 2068 | eval('opts_orig.'+a+' = b'); 2069 | if (c !== false) reInit = true; 2070 | else eval('opts.'+a+' = b'); 2071 | } 2072 | // return value for specific option 2073 | else 2074 | { 2075 | return eval('opts.'+a); 2076 | } 2077 | } 2078 | if (reInit) 2079 | { 2080 | sz_resetMargin($cfs.children(), opts); 2081 | FN._init(opts_orig); 2082 | FN._bind_buttons(); 2083 | var sz = sz_setSizes($cfs, opts); 2084 | $cfs.trigger(cf_e('updatePageStatus', conf), [true, sz]); 2085 | } 2086 | return opts; 2087 | }); 2088 | 2089 | 2090 | // linkAnchors event 2091 | $cfs.bind(cf_e('linkAnchors', conf), function(e, $con, sel) { 2092 | e.stopPropagation(); 2093 | 2094 | if (is_undefined($con)) 2095 | { 2096 | $con = $('body'); 2097 | } 2098 | else if (is_string($con)) 2099 | { 2100 | $con = $($con); 2101 | } 2102 | if (!is_jquery($con) || $con.length == 0) 2103 | { 2104 | return debug(conf, 'Not a valid object.'); 2105 | } 2106 | if (!is_string(sel)) 2107 | { 2108 | sel = 'a.caroufredsel'; 2109 | } 2110 | 2111 | $con.find(sel).each(function() { 2112 | var h = this.hash || ''; 2113 | if (h.length > 0 && $cfs.children().index($(h)) != -1) 2114 | { 2115 | $(this).unbind('click').click(function(e) { 2116 | e.preventDefault(); 2117 | $cfs.trigger(cf_e('slideTo', conf), h); 2118 | }); 2119 | } 2120 | }); 2121 | return true; 2122 | }); 2123 | 2124 | 2125 | // updatePageStatus event 2126 | $cfs.bind(cf_e('updatePageStatus', conf), function(e, build, sizes) { 2127 | e.stopPropagation(); 2128 | if (!opts.pagination.container) 2129 | { 2130 | return; 2131 | } 2132 | 2133 | var ipp = opts.pagination.items || opts.items.visible, 2134 | pgs = Math.ceil(itms.total/ipp); 2135 | 2136 | if (build) 2137 | { 2138 | if (opts.pagination.anchorBuilder) 2139 | { 2140 | opts.pagination.container.children().remove(); 2141 | opts.pagination.container.each(function() { 2142 | for (var a = 0; a < pgs; a++) 2143 | { 2144 | var i = $cfs.children().eq( gn_getItemIndex(a*ipp, 0, true, itms, $cfs) ); 2145 | $(this).append(opts.pagination.anchorBuilder.call(i[0], a+1)); 2146 | } 2147 | }); 2148 | } 2149 | opts.pagination.container.each(function() { 2150 | $(this).children().unbind(opts.pagination.event).each(function(a) { 2151 | $(this).bind(opts.pagination.event, function(e) { 2152 | e.preventDefault(); 2153 | $cfs.trigger(cf_e('slideTo', conf), [a*ipp, -opts.pagination.deviation, true, opts.pagination]); 2154 | }); 2155 | }); 2156 | }); 2157 | } 2158 | 2159 | var selected = $cfs.triggerHandler(cf_e('currentPage', conf)) + opts.pagination.deviation; 2160 | if (selected >= pgs) 2161 | { 2162 | selected = 0; 2163 | } 2164 | if (selected < 0) 2165 | { 2166 | selected = pgs-1; 2167 | } 2168 | opts.pagination.container.each(function() { 2169 | $(this).children().removeClass(cf_c('selected', conf)).eq(selected).addClass(cf_c('selected', conf)); 2170 | }); 2171 | return true; 2172 | }); 2173 | 2174 | 2175 | // updateSizes event 2176 | $cfs.bind(cf_e('updateSizes', conf), function(e) { 2177 | var vI = opts.items.visible, 2178 | a_itm = $cfs.children(), 2179 | avail_primary = ms_getParentSize($wrp, opts, 'width'); 2180 | 2181 | itms.total = a_itm.length; 2182 | 2183 | if (crsl.primarySizePercentage) 2184 | { 2185 | opts.maxDimension = avail_primary; 2186 | opts[opts.d['width']] = ms_getPercentage(avail_primary, crsl.primarySizePercentage); 2187 | } 2188 | else 2189 | { 2190 | opts.maxDimension = ms_getMaxDimension(opts, avail_primary); 2191 | } 2192 | 2193 | if (opts.responsive) 2194 | { 2195 | opts.items.width = opts.items.sizesConf.width; 2196 | opts.items.height = opts.items.sizesConf.height; 2197 | opts = in_getResponsiveValues(opts, a_itm, avail_primary); 2198 | vI = opts.items.visible; 2199 | sz_setResponsiveSizes(opts, a_itm); 2200 | } 2201 | else if (opts.items.visibleConf.variable) 2202 | { 2203 | vI = gn_getVisibleItemsNext(a_itm, opts, 0); 2204 | } 2205 | else if (opts.items.filter != '*') 2206 | { 2207 | vI = gn_getVisibleItemsNextFilter(a_itm, opts, 0); 2208 | } 2209 | 2210 | if (!opts.circular && itms.first != 0 && vI > itms.first) { 2211 | if (opts.items.visibleConf.variable) 2212 | { 2213 | var nI = gn_getVisibleItemsPrev(a_itm, opts, itms.first) - itms.first; 2214 | } 2215 | else if (opts.items.filter != '*') 2216 | { 2217 | var nI = gn_getVisibleItemsPrevFilter(a_itm, opts, itms.first) - itms.first; 2218 | } 2219 | else 2220 | { 2221 | var nI = opts.items.visible - itms.first; 2222 | } 2223 | debug(conf, 'Preventing non-circular: sliding '+nI+' items backward.'); 2224 | $cfs.trigger(cf_e('prev', conf), nI); 2225 | } 2226 | 2227 | opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0); 2228 | opts.items.visibleConf.old = opts.items.visible; 2229 | opts = in_getAlignPadding(opts, a_itm); 2230 | 2231 | var sz = sz_setSizes($cfs, opts); 2232 | $cfs.trigger(cf_e('updatePageStatus', conf), [true, sz]); 2233 | nv_showNavi(opts, itms.total, conf); 2234 | nv_enableNavi(opts, itms.first, conf); 2235 | 2236 | return sz; 2237 | }); 2238 | 2239 | 2240 | // destroy event 2241 | $cfs.bind(cf_e('destroy', conf), function(e, orgOrder) { 2242 | e.stopPropagation(); 2243 | tmrs = sc_clearTimers(tmrs); 2244 | 2245 | $cfs.data('_cfs_isCarousel', false); 2246 | $cfs.trigger(cf_e('finish', conf)); 2247 | if (orgOrder) 2248 | { 2249 | $cfs.trigger(cf_e('jumpToStart', conf)); 2250 | } 2251 | sz_restoreOrigCss($cfs.children()); 2252 | sz_restoreOrigCss($cfs); 2253 | FN._unbind_events(); 2254 | FN._unbind_buttons(); 2255 | if (conf.wrapper == 'parent') 2256 | { 2257 | sz_restoreOrigCss($wrp); 2258 | } 2259 | else 2260 | { 2261 | $wrp.replaceWith($cfs); 2262 | } 2263 | 2264 | return true; 2265 | }); 2266 | 2267 | 2268 | // debug event 2269 | $cfs.bind(cf_e('debug', conf), function(e) { 2270 | debug(conf, 'Carousel width: ' + opts.width); 2271 | debug(conf, 'Carousel height: ' + opts.height); 2272 | debug(conf, 'Item widths: ' + opts.items.width); 2273 | debug(conf, 'Item heights: ' + opts.items.height); 2274 | debug(conf, 'Number of items visible: ' + opts.items.visible); 2275 | if (opts.auto.play) 2276 | { 2277 | debug(conf, 'Number of items scrolled automatically: ' + opts.auto.items); 2278 | } 2279 | if (opts.prev.button) 2280 | { 2281 | debug(conf, 'Number of items scrolled backward: ' + opts.prev.items); 2282 | } 2283 | if (opts.next.button) 2284 | { 2285 | debug(conf, 'Number of items scrolled forward: ' + opts.next.items); 2286 | } 2287 | return conf.debug; 2288 | }); 2289 | 2290 | 2291 | // triggerEvent, making prefixed and namespaced events accessible from outside 2292 | $cfs.bind('_cfs_triggerEvent', function(e, n, o) { 2293 | e.stopPropagation(); 2294 | return $cfs.triggerHandler(cf_e(n, conf), o); 2295 | }); 2296 | }; // /bind_events 2297 | 2298 | 2299 | FN._unbind_events = function() { 2300 | $cfs.unbind(cf_e('', conf)); 2301 | $cfs.unbind(cf_e('', conf, false)); 2302 | $cfs.unbind('_cfs_triggerEvent'); 2303 | }; // /unbind_events 2304 | 2305 | 2306 | FN._bind_buttons = function() { 2307 | FN._unbind_buttons(); 2308 | nv_showNavi(opts, itms.total, conf); 2309 | nv_enableNavi(opts, itms.first, conf); 2310 | 2311 | if (opts.auto.pauseOnHover) 2312 | { 2313 | var pC = bt_pauseOnHoverConfig(opts.auto.pauseOnHover); 2314 | $wrp.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC); }) 2315 | .bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf)); }); 2316 | } 2317 | 2318 | // play button 2319 | if (opts.auto.button) 2320 | { 2321 | opts.auto.button.bind(cf_e(opts.auto.event, conf, false), function(e) { 2322 | e.preventDefault(); 2323 | var ev = false, 2324 | pC = null; 2325 | 2326 | if (crsl.isPaused) 2327 | { 2328 | ev = 'play'; 2329 | } 2330 | else if (opts.auto.pauseOnEvent) 2331 | { 2332 | ev = 'pause'; 2333 | pC = bt_pauseOnHoverConfig(opts.auto.pauseOnEvent); 2334 | } 2335 | if (ev) 2336 | { 2337 | $cfs.trigger(cf_e(ev, conf), pC); 2338 | } 2339 | }); 2340 | } 2341 | 2342 | // prev button 2343 | if (opts.prev.button) 2344 | { 2345 | opts.prev.button.bind(cf_e(opts.prev.event, conf, false), function(e) { 2346 | e.preventDefault(); 2347 | $cfs.trigger(cf_e('prev', conf)); 2348 | }); 2349 | if (opts.prev.pauseOnHover) 2350 | { 2351 | var pC = bt_pauseOnHoverConfig(opts.prev.pauseOnHover); 2352 | opts.prev.button.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC); }) 2353 | .bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf)); }); 2354 | } 2355 | } 2356 | 2357 | // next butotn 2358 | if (opts.next.button) 2359 | { 2360 | opts.next.button.bind(cf_e(opts.next.event, conf, false), function(e) { 2361 | e.preventDefault(); 2362 | $cfs.trigger(cf_e('next', conf)); 2363 | }); 2364 | if (opts.next.pauseOnHover) 2365 | { 2366 | var pC = bt_pauseOnHoverConfig(opts.next.pauseOnHover); 2367 | opts.next.button.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC); }) 2368 | .bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf)); }); 2369 | } 2370 | } 2371 | 2372 | // pagination 2373 | if (opts.pagination.container) 2374 | { 2375 | if (opts.pagination.pauseOnHover) 2376 | { 2377 | var pC = bt_pauseOnHoverConfig(opts.pagination.pauseOnHover); 2378 | opts.pagination.container.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC); }) 2379 | .bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf)); }); 2380 | } 2381 | } 2382 | 2383 | // prev/next keys 2384 | if (opts.prev.key || opts.next.key) 2385 | { 2386 | $(document).bind(cf_e('keyup', conf, false, true, true), function(e) { 2387 | var k = e.keyCode; 2388 | if (k == opts.next.key) 2389 | { 2390 | e.preventDefault(); 2391 | $cfs.trigger(cf_e('next', conf)); 2392 | } 2393 | if (k == opts.prev.key) 2394 | { 2395 | e.preventDefault(); 2396 | $cfs.trigger(cf_e('prev', conf)); 2397 | } 2398 | }); 2399 | } 2400 | 2401 | // pagination keys 2402 | if (opts.pagination.keys) 2403 | { 2404 | $(document).bind(cf_e('keyup', conf, false, true, true), function(e) { 2405 | var k = e.keyCode; 2406 | if (k >= 49 && k < 58) 2407 | { 2408 | k = (k-49) * opts.items.visible; 2409 | if (k <= itms.total) 2410 | { 2411 | e.preventDefault(); 2412 | $cfs.trigger(cf_e('slideTo', conf), [k, 0, true, opts.pagination]); 2413 | } 2414 | } 2415 | }); 2416 | } 2417 | 2418 | // swipe 2419 | if ($.fn.swipe) 2420 | { 2421 | var isTouch = 'ontouchstart' in window; 2422 | if ((isTouch && opts.swipe.onTouch) || (!isTouch && opts.swipe.onMouse)) 2423 | { 2424 | var scP = $.extend(true, {}, opts.prev, opts.swipe), 2425 | scN = $.extend(true, {}, opts.next, opts.swipe), 2426 | swP = function() { $cfs.trigger(cf_e('prev', conf), [scP]) }, 2427 | swN = function() { $cfs.trigger(cf_e('next', conf), [scN]) }; 2428 | 2429 | switch (opts.direction) 2430 | { 2431 | case 'up': 2432 | case 'down': 2433 | opts.swipe.options.swipeUp = swN; 2434 | opts.swipe.options.swipeDown = swP; 2435 | break; 2436 | default: 2437 | opts.swipe.options.swipeLeft = swN; 2438 | opts.swipe.options.swipeRight = swP; 2439 | } 2440 | if (crsl.swipe) 2441 | { 2442 | $cfs.swipe('destroy'); 2443 | } 2444 | $wrp.swipe(opts.swipe.options); 2445 | $wrp.css('cursor', 'move'); 2446 | crsl.swipe = true; 2447 | } 2448 | } 2449 | 2450 | // mousewheel 2451 | if ($.fn.mousewheel) 2452 | { 2453 | 2454 | if (opts.mousewheel) 2455 | { 2456 | var mcP = $.extend(true, {}, opts.prev, opts.mousewheel), 2457 | mcN = $.extend(true, {}, opts.next, opts.mousewheel); 2458 | 2459 | if (crsl.mousewheel) 2460 | { 2461 | $wrp.unbind(cf_e('mousewheel', conf, false)); 2462 | } 2463 | $wrp.bind(cf_e('mousewheel', conf, false), function(e, delta) { 2464 | e.preventDefault(); 2465 | if (delta > 0) 2466 | { 2467 | $cfs.trigger(cf_e('prev', conf), [mcP]); 2468 | } 2469 | else 2470 | { 2471 | $cfs.trigger(cf_e('next', conf), [mcN]); 2472 | } 2473 | }); 2474 | crsl.mousewheel = true; 2475 | } 2476 | } 2477 | 2478 | if (opts.auto.play) 2479 | { 2480 | $cfs.trigger(cf_e('play', conf), opts.auto.delay); 2481 | } 2482 | 2483 | if (crsl.upDateOnWindowResize) 2484 | { 2485 | var resizeFn = function(e) { 2486 | $cfs.trigger(cf_e('finish', conf)); 2487 | if (opts.auto.pauseOnResize && !crsl.isPaused) 2488 | { 2489 | $cfs.trigger(cf_e('play', conf)); 2490 | } 2491 | sz_resetMargin($cfs.children(), opts); 2492 | $cfs.trigger(cf_e('updateSizes', conf)); 2493 | }; 2494 | 2495 | var $w = $(window), 2496 | onResize = null; 2497 | 2498 | if ($.debounce && conf.onWindowResize == 'debounce') 2499 | { 2500 | onResize = $.debounce(200, resizeFn); 2501 | } 2502 | else if ($.throttle && conf.onWindowResize == 'throttle') 2503 | { 2504 | onResize = $.throttle(300, resizeFn); 2505 | } 2506 | else 2507 | { 2508 | var _windowWidth = 0, 2509 | _windowHeight = 0; 2510 | 2511 | onResize = function() { 2512 | var nw = $w.width(), 2513 | nh = $w.height(); 2514 | 2515 | if (nw != _windowWidth || nh != _windowHeight) 2516 | { 2517 | resizeFn(); 2518 | _windowWidth = nw; 2519 | _windowHeight = nh; 2520 | } 2521 | }; 2522 | } 2523 | $w.bind(cf_e('resize', conf, false, true, true), onResize); 2524 | } 2525 | }; // /bind_buttons 2526 | 2527 | 2528 | FN._unbind_buttons = function() { 2529 | var ns1 = cf_e('', conf), 2530 | ns2 = cf_e('', conf, false); 2531 | ns3 = cf_e('', conf, false, true, true); 2532 | 2533 | $(document).unbind(ns3); 2534 | $(window).unbind(ns3); 2535 | $wrp.unbind(ns2); 2536 | 2537 | if (opts.auto.button) 2538 | { 2539 | opts.auto.button.unbind(ns2); 2540 | } 2541 | if (opts.prev.button) 2542 | { 2543 | opts.prev.button.unbind(ns2); 2544 | } 2545 | if (opts.next.button) 2546 | { 2547 | opts.next.button.unbind(ns2); 2548 | } 2549 | if (opts.pagination.container) 2550 | { 2551 | opts.pagination.container.unbind(ns2); 2552 | if (opts.pagination.anchorBuilder) 2553 | { 2554 | opts.pagination.container.children().remove(); 2555 | } 2556 | } 2557 | if (crsl.swipe) 2558 | { 2559 | $cfs.swipe('destroy'); 2560 | $wrp.css('cursor', 'default'); 2561 | crsl.swipe = false; 2562 | } 2563 | if (crsl.mousewheel) 2564 | { 2565 | crsl.mousewheel = false; 2566 | } 2567 | 2568 | nv_showNavi(opts, 'hide', conf); 2569 | nv_enableNavi(opts, 'removeClass', conf); 2570 | 2571 | }; // /unbind_buttons 2572 | 2573 | 2574 | 2575 | // START 2576 | 2577 | if (is_boolean(configs)) 2578 | { 2579 | configs = { 2580 | 'debug': configs 2581 | }; 2582 | } 2583 | 2584 | // set vars 2585 | var crsl = { 2586 | 'direction' : 'next', 2587 | 'isPaused' : true, 2588 | 'isScrolling' : false, 2589 | 'isStopped' : false, 2590 | 'mousewheel' : false, 2591 | 'swipe' : false 2592 | }, 2593 | itms = { 2594 | 'total' : $cfs.children().length, 2595 | 'first' : 0 2596 | }, 2597 | tmrs = { 2598 | 'auto' : null, 2599 | 'progress' : null, 2600 | 'startTime' : getTime(), 2601 | 'timePassed' : 0 2602 | }, 2603 | scrl = { 2604 | 'isStopped' : false, 2605 | 'duration' : 0, 2606 | 'startTime' : 0, 2607 | 'easing' : '', 2608 | 'anims' : [] 2609 | }, 2610 | clbk = { 2611 | 'onBefore' : [], 2612 | 'onAfter' : [] 2613 | }, 2614 | queu = [], 2615 | conf = $.extend(true, {}, $.fn.carouFredSel.configs, configs), 2616 | opts = {}, 2617 | opts_orig = $.extend(true, {}, options), 2618 | $wrp = (conf.wrapper == 'parent') 2619 | ? $cfs.parent() 2620 | : $cfs.wrap('<'+conf.wrapper.element+' class="'+conf.wrapper.classname+'" />').parent(); 2621 | 2622 | 2623 | conf.selector = $cfs.selector; 2624 | conf.serialNumber = $.fn.carouFredSel.serialNumber++; 2625 | 2626 | conf.transition = (conf.transition && $.fn.transition) ? 'transition' : 'animate'; 2627 | 2628 | // create carousel 2629 | FN._init(opts_orig, true, starting_position); 2630 | FN._build(); 2631 | FN._bind_events(); 2632 | FN._bind_buttons(); 2633 | 2634 | // find item to start 2635 | if (is_array(opts.items.start)) 2636 | { 2637 | var start_arr = opts.items.start; 2638 | } 2639 | else 2640 | { 2641 | var start_arr = []; 2642 | if (opts.items.start != 0) 2643 | { 2644 | start_arr.push(opts.items.start); 2645 | } 2646 | } 2647 | if (opts.cookie) 2648 | { 2649 | start_arr.unshift(parseInt(cf_getCookie(opts.cookie), 10)); 2650 | } 2651 | 2652 | if (start_arr.length > 0) 2653 | { 2654 | for (var a = 0, l = start_arr.length; a < l; a++) 2655 | { 2656 | var s = start_arr[a]; 2657 | if (s == 0) 2658 | { 2659 | continue; 2660 | } 2661 | if (s === true) 2662 | { 2663 | s = window.location.hash; 2664 | if (s.length < 1) 2665 | { 2666 | continue; 2667 | } 2668 | } 2669 | else if (s === 'random') 2670 | { 2671 | s = Math.floor(Math.random()*itms.total); 2672 | } 2673 | if ($cfs.triggerHandler(cf_e('slideTo', conf), [s, 0, true, { fx: 'none' }])) 2674 | { 2675 | break; 2676 | } 2677 | } 2678 | } 2679 | var siz = sz_setSizes($cfs, opts), 2680 | itm = gi_getCurrentItems($cfs.children(), opts); 2681 | 2682 | if (opts.onCreate) 2683 | { 2684 | opts.onCreate.call($tt0, { 2685 | 'width': siz.width, 2686 | 'height': siz.height, 2687 | 'items': itm 2688 | }); 2689 | } 2690 | 2691 | $cfs.trigger(cf_e('updatePageStatus', conf), [true, siz]); 2692 | $cfs.trigger(cf_e('linkAnchors', conf)); 2693 | 2694 | if (conf.debug) 2695 | { 2696 | $cfs.trigger(cf_e('debug', conf)); 2697 | } 2698 | 2699 | return $cfs; 2700 | }; 2701 | 2702 | 2703 | 2704 | // GLOBAL PUBLIC 2705 | 2706 | $.fn.carouFredSel.serialNumber = 1; 2707 | $.fn.carouFredSel.defaults = { 2708 | 'synchronise' : false, 2709 | 'infinite' : true, 2710 | 'circular' : true, 2711 | 'responsive' : false, 2712 | 'direction' : 'left', 2713 | 'items' : { 2714 | 'start' : 0 2715 | }, 2716 | 'scroll' : { 2717 | 'easing' : 'swing', 2718 | 'duration' : 500, 2719 | 'pauseOnHover' : false, 2720 | 'event' : 'click', 2721 | 'queue' : false 2722 | } 2723 | }; 2724 | $.fn.carouFredSel.configs = { 2725 | 'debug' : false, 2726 | 'transition' : false, 2727 | 'onWindowResize': 'throttle', 2728 | 'events' : { 2729 | 'prefix' : '', 2730 | 'namespace' : 'cfs' 2731 | }, 2732 | 'wrapper' : { 2733 | 'element' : 'div', 2734 | 'classname' : 'caroufredsel_wrapper' 2735 | }, 2736 | 'classnames' : {} 2737 | }; 2738 | $.fn.carouFredSel.pageAnchorBuilder = function(nr) { 2739 | return ''+nr+''; 2740 | }; 2741 | $.fn.carouFredSel.progressbarUpdater = function(perc) { 2742 | $(this).css('width', perc+'%'); 2743 | }; 2744 | 2745 | $.fn.carouFredSel.cookie = { 2746 | get: function(n) { 2747 | n += '='; 2748 | var ca = document.cookie.split(';'); 2749 | for (var a = 0, l = ca.length; a < l; a++) 2750 | { 2751 | var c = ca[a]; 2752 | while (c.charAt(0) == ' ') 2753 | { 2754 | c = c.slice(1); 2755 | } 2756 | if (c.indexOf(n) == 0) 2757 | { 2758 | return c.slice(n.length); 2759 | } 2760 | } 2761 | return 0; 2762 | }, 2763 | set: function(n, v, d) { 2764 | var e = ""; 2765 | if (d) 2766 | { 2767 | var date = new Date(); 2768 | date.setTime(date.getTime() + (d * 24 * 60 * 60 * 1000)); 2769 | e = "; expires=" + date.toGMTString(); 2770 | } 2771 | document.cookie = n + '=' + v + e + '; path=/'; 2772 | }, 2773 | remove: function(n) { 2774 | $.fn.carouFredSel.cookie.set(n, "", -1); 2775 | } 2776 | }; 2777 | 2778 | 2779 | // GLOBAL PRIVATE 2780 | 2781 | // scrolling functions 2782 | function sc_setScroll(d, e, c) { 2783 | if (c.transition == 'transition') 2784 | { 2785 | if (e == 'swing') 2786 | { 2787 | e = 'ease'; 2788 | } 2789 | } 2790 | return { 2791 | anims: [], 2792 | duration: d, 2793 | orgDuration: d, 2794 | easing: e, 2795 | startTime: getTime() 2796 | }; 2797 | } 2798 | function sc_startScroll(s, c) { 2799 | for (var a = 0, l = s.anims.length; a < l; a++) 2800 | { 2801 | var b = s.anims[a]; 2802 | if (!b) 2803 | { 2804 | continue; 2805 | } 2806 | b[0][c.transition](b[1], s.duration, s.easing, b[2]); 2807 | } 2808 | } 2809 | function sc_stopScroll(s, finish) { 2810 | if (!is_boolean(finish)) 2811 | { 2812 | finish = true; 2813 | } 2814 | if (is_object(s.pre)) 2815 | { 2816 | sc_stopScroll(s.pre, finish); 2817 | } 2818 | for (var a = 0, l = s.anims.length; a < l; a++) 2819 | { 2820 | var b = s.anims[a]; 2821 | b[0].stop(true); 2822 | if (finish) 2823 | { 2824 | b[0].css(b[1]); 2825 | if (is_function(b[2])) 2826 | { 2827 | b[2](); 2828 | } 2829 | } 2830 | } 2831 | if (is_object(s.post)) 2832 | { 2833 | sc_stopScroll(s.post, finish); 2834 | } 2835 | } 2836 | function sc_afterScroll( $c, $c2, o ) { 2837 | if ($c2) 2838 | { 2839 | $c2.remove(); 2840 | } 2841 | 2842 | switch(o.fx) { 2843 | case 'fade': 2844 | case 'crossfade': 2845 | case 'cover-fade': 2846 | case 'uncover-fade': 2847 | $c.css('opacity', 1); 2848 | $c.css('filter', ''); 2849 | break; 2850 | } 2851 | } 2852 | function sc_fireCallbacks($t, o, b, a, c) { 2853 | if (o[b]) 2854 | { 2855 | o[b].call($t, a); 2856 | } 2857 | if (c[b].length) 2858 | { 2859 | for (var i = 0, l = c[b].length; i < l; i++) 2860 | { 2861 | c[b][i].call($t, a); 2862 | } 2863 | } 2864 | return []; 2865 | } 2866 | function sc_fireQueue($c, q, c) { 2867 | 2868 | if (q.length) 2869 | { 2870 | $c.trigger(cf_e(q[0][0], c), q[0][1]); 2871 | q.shift(); 2872 | } 2873 | return q; 2874 | } 2875 | function sc_hideHiddenItems(hiddenitems) { 2876 | hiddenitems.each(function() { 2877 | var hi = $(this); 2878 | hi.data('_cfs_isHidden', hi.is(':hidden')).hide(); 2879 | }); 2880 | } 2881 | function sc_showHiddenItems(hiddenitems) { 2882 | if (hiddenitems) 2883 | { 2884 | hiddenitems.each(function() { 2885 | var hi = $(this); 2886 | if (!hi.data('_cfs_isHidden')) 2887 | { 2888 | hi.show(); 2889 | } 2890 | }); 2891 | } 2892 | } 2893 | function sc_clearTimers(t) { 2894 | if (t.auto) 2895 | { 2896 | clearTimeout(t.auto); 2897 | } 2898 | if (t.progress) 2899 | { 2900 | clearInterval(t.progress); 2901 | } 2902 | return t; 2903 | } 2904 | function sc_mapCallbackArguments(i_old, i_skp, i_new, s_itm, s_dir, s_dur, w_siz) { 2905 | return { 2906 | 'width': w_siz.width, 2907 | 'height': w_siz.height, 2908 | 'items': { 2909 | 'old': i_old, 2910 | 'skipped': i_skp, 2911 | 'visible': i_new 2912 | }, 2913 | 'scroll': { 2914 | 'items': s_itm, 2915 | 'direction': s_dir, 2916 | 'duration': s_dur 2917 | } 2918 | }; 2919 | } 2920 | function sc_getDuration( sO, o, nI, siz ) { 2921 | var dur = sO.duration; 2922 | if (sO.fx == 'none') 2923 | { 2924 | return 0; 2925 | } 2926 | if (dur == 'auto') 2927 | { 2928 | dur = o.scroll.duration / o.scroll.items * nI; 2929 | } 2930 | else if (dur < 10) 2931 | { 2932 | dur = siz / dur; 2933 | } 2934 | if (dur < 1) 2935 | { 2936 | return 0; 2937 | } 2938 | if (sO.fx == 'fade') 2939 | { 2940 | dur = dur / 2; 2941 | } 2942 | return Math.round(dur); 2943 | } 2944 | 2945 | // navigation functions 2946 | function nv_showNavi(o, t, c) { 2947 | var minimum = (is_number(o.items.minimum)) ? o.items.minimum : o.items.visible + 1; 2948 | if (t == 'show' || t == 'hide') 2949 | { 2950 | var f = t; 2951 | } 2952 | else if (minimum > t) 2953 | { 2954 | debug(c, 'Not enough items ('+t+' total, '+minimum+' needed): Hiding navigation.'); 2955 | var f = 'hide'; 2956 | } 2957 | else 2958 | { 2959 | var f = 'show'; 2960 | } 2961 | var s = (f == 'show') ? 'removeClass' : 'addClass', 2962 | h = cf_c('hidden', c); 2963 | 2964 | if (o.auto.button) 2965 | { 2966 | o.auto.button[f]()[s](h); 2967 | } 2968 | if (o.prev.button) 2969 | { 2970 | o.prev.button[f]()[s](h); 2971 | } 2972 | if (o.next.button) 2973 | { 2974 | o.next.button[f]()[s](h); 2975 | } 2976 | if (o.pagination.container) 2977 | { 2978 | o.pagination.container[f]()[s](h); 2979 | } 2980 | } 2981 | function nv_enableNavi(o, f, c) { 2982 | if (o.circular || o.infinite) return; 2983 | var fx = (f == 'removeClass' || f == 'addClass') ? f : false, 2984 | di = cf_c('disabled', c); 2985 | 2986 | if (o.auto.button && fx) 2987 | { 2988 | o.auto.button[fx](di); 2989 | } 2990 | if (o.prev.button) 2991 | { 2992 | var fn = fx || (f == 0) ? 'addClass' : 'removeClass'; 2993 | o.prev.button[fn](di); 2994 | } 2995 | if (o.next.button) 2996 | { 2997 | var fn = fx || (f == o.items.visible) ? 'addClass' : 'removeClass'; 2998 | o.next.button[fn](di); 2999 | } 3000 | } 3001 | 3002 | // get object functions 3003 | function go_getObject($tt, obj) { 3004 | if (is_function(obj)) 3005 | { 3006 | obj = obj.call($tt); 3007 | } 3008 | else if (is_undefined(obj)) 3009 | { 3010 | obj = {}; 3011 | } 3012 | return obj; 3013 | } 3014 | function go_getItemsObject($tt, obj) { 3015 | obj = go_getObject($tt, obj); 3016 | if (is_number(obj)) 3017 | { 3018 | obj = { 3019 | 'visible': obj 3020 | }; 3021 | } 3022 | else if (obj == 'variable') 3023 | { 3024 | obj = { 3025 | 'visible': obj, 3026 | 'width': obj, 3027 | 'height': obj 3028 | }; 3029 | } 3030 | else if (!is_object(obj)) 3031 | { 3032 | obj = {}; 3033 | } 3034 | return obj; 3035 | } 3036 | function go_getScrollObject($tt, obj) { 3037 | obj = go_getObject($tt, obj); 3038 | if (is_number(obj)) 3039 | { 3040 | if (obj <= 50) 3041 | { 3042 | obj = { 3043 | 'items': obj 3044 | }; 3045 | } 3046 | else 3047 | { 3048 | obj = { 3049 | 'duration': obj 3050 | }; 3051 | } 3052 | } 3053 | else if (is_string(obj)) 3054 | { 3055 | obj = { 3056 | 'easing': obj 3057 | }; 3058 | } 3059 | else if (!is_object(obj)) 3060 | { 3061 | obj = {}; 3062 | } 3063 | return obj; 3064 | } 3065 | function go_getNaviObject($tt, obj) { 3066 | obj = go_getObject($tt, obj); 3067 | if (is_string(obj)) 3068 | { 3069 | var temp = cf_getKeyCode(obj); 3070 | if (temp == -1) 3071 | { 3072 | obj = $(obj); 3073 | } 3074 | else 3075 | { 3076 | obj = temp; 3077 | } 3078 | } 3079 | return obj; 3080 | } 3081 | 3082 | function go_getAutoObject($tt, obj) { 3083 | obj = go_getNaviObject($tt, obj); 3084 | if (is_jquery(obj)) 3085 | { 3086 | obj = { 3087 | 'button': obj 3088 | }; 3089 | } 3090 | else if (is_boolean(obj)) 3091 | { 3092 | obj = { 3093 | 'play': obj 3094 | }; 3095 | } 3096 | else if (is_number(obj)) 3097 | { 3098 | obj = { 3099 | 'timeoutDuration': obj 3100 | }; 3101 | } 3102 | if (obj.progress) 3103 | { 3104 | if (is_string(obj.progress) || is_jquery(obj.progress)) 3105 | { 3106 | obj.progress = { 3107 | 'bar': obj.progress 3108 | }; 3109 | } 3110 | } 3111 | return obj; 3112 | } 3113 | function go_complementAutoObject($tt, obj) { 3114 | if (is_function(obj.button)) 3115 | { 3116 | obj.button = obj.button.call($tt); 3117 | } 3118 | if (is_string(obj.button)) 3119 | { 3120 | obj.button = $(obj.button); 3121 | } 3122 | if (!is_boolean(obj.play)) 3123 | { 3124 | obj.play = true; 3125 | } 3126 | if (!is_number(obj.delay)) 3127 | { 3128 | obj.delay = 0; 3129 | } 3130 | if (is_undefined(obj.pauseOnEvent)) 3131 | { 3132 | obj.pauseOnEvent = true; 3133 | } 3134 | if (!is_boolean(obj.pauseOnResize)) 3135 | { 3136 | obj.pauseOnResize = true; 3137 | } 3138 | if (!is_number(obj.timeoutDuration)) 3139 | { 3140 | obj.timeoutDuration = (obj.duration < 10) 3141 | ? 2500 3142 | : obj.duration * 5; 3143 | } 3144 | if (obj.progress) 3145 | { 3146 | if (is_function(obj.progress.bar)) 3147 | { 3148 | obj.progress.bar = obj.progress.bar.call($tt); 3149 | } 3150 | if (is_string(obj.progress.bar)) 3151 | { 3152 | obj.progress.bar = $(obj.progress.bar); 3153 | } 3154 | if (obj.progress.bar) 3155 | { 3156 | if (!is_function(obj.progress.updater)) 3157 | { 3158 | obj.progress.updater = $.fn.carouFredSel.progressbarUpdater; 3159 | } 3160 | if (!is_number(obj.progress.interval)) 3161 | { 3162 | obj.progress.interval = 50; 3163 | } 3164 | } 3165 | else 3166 | { 3167 | obj.progress = false; 3168 | } 3169 | } 3170 | return obj; 3171 | } 3172 | 3173 | function go_getPrevNextObject($tt, obj) { 3174 | obj = go_getNaviObject($tt, obj); 3175 | if (is_jquery(obj)) 3176 | { 3177 | obj = { 3178 | 'button': obj 3179 | }; 3180 | } 3181 | else if (is_number(obj)) 3182 | { 3183 | obj = { 3184 | 'key': obj 3185 | }; 3186 | } 3187 | return obj; 3188 | } 3189 | function go_complementPrevNextObject($tt, obj) { 3190 | if (is_function(obj.button)) 3191 | { 3192 | obj.button = obj.button.call($tt); 3193 | } 3194 | if (is_string(obj.button)) 3195 | { 3196 | obj.button = $(obj.button); 3197 | } 3198 | if (is_string(obj.key)) 3199 | { 3200 | obj.key = cf_getKeyCode(obj.key); 3201 | } 3202 | return obj; 3203 | } 3204 | 3205 | function go_getPaginationObject($tt, obj) { 3206 | obj = go_getNaviObject($tt, obj); 3207 | if (is_jquery(obj)) 3208 | { 3209 | obj = { 3210 | 'container': obj 3211 | }; 3212 | } 3213 | else if (is_boolean(obj)) 3214 | { 3215 | obj = { 3216 | 'keys': obj 3217 | }; 3218 | } 3219 | return obj; 3220 | } 3221 | function go_complementPaginationObject($tt, obj) { 3222 | if (is_function(obj.container)) 3223 | { 3224 | obj.container = obj.container.call($tt); 3225 | } 3226 | if (is_string(obj.container)) 3227 | { 3228 | obj.container = $(obj.container); 3229 | } 3230 | if (!is_number(obj.items)) 3231 | { 3232 | obj.items = false; 3233 | } 3234 | if (!is_boolean(obj.keys)) 3235 | { 3236 | obj.keys = false; 3237 | } 3238 | if (!is_function(obj.anchorBuilder) && !is_false(obj.anchorBuilder)) 3239 | { 3240 | obj.anchorBuilder = $.fn.carouFredSel.pageAnchorBuilder; 3241 | } 3242 | if (!is_number(obj.deviation)) 3243 | { 3244 | obj.deviation = 0; 3245 | } 3246 | return obj; 3247 | } 3248 | 3249 | function go_getSwipeObject($tt, obj) { 3250 | if (is_function(obj)) 3251 | { 3252 | obj = obj.call($tt); 3253 | } 3254 | if (is_undefined(obj)) 3255 | { 3256 | obj = { 3257 | 'onTouch': false 3258 | }; 3259 | } 3260 | if (is_true(obj)) 3261 | { 3262 | obj = { 3263 | 'onTouch': obj 3264 | }; 3265 | } 3266 | else if (is_number(obj)) 3267 | { 3268 | obj = { 3269 | 'items': obj 3270 | }; 3271 | } 3272 | return obj; 3273 | } 3274 | function go_complementSwipeObject($tt, obj) { 3275 | if (!is_boolean(obj.onTouch)) 3276 | { 3277 | obj.onTouch = true; 3278 | } 3279 | if (!is_boolean(obj.onMouse)) 3280 | { 3281 | obj.onMouse = false; 3282 | } 3283 | if (!is_object(obj.options)) 3284 | { 3285 | obj.options = {}; 3286 | } 3287 | if (!is_boolean(obj.options.triggerOnTouchEnd)) 3288 | { 3289 | obj.options.triggerOnTouchEnd = false; 3290 | } 3291 | return obj; 3292 | } 3293 | function go_getMousewheelObject($tt, obj) { 3294 | if (is_function(obj)) 3295 | { 3296 | obj = obj.call($tt); 3297 | } 3298 | if (is_true(obj)) 3299 | { 3300 | obj = {}; 3301 | } 3302 | else if (is_number(obj)) 3303 | { 3304 | obj = { 3305 | 'items': obj 3306 | }; 3307 | } 3308 | else if (is_undefined(obj)) 3309 | { 3310 | obj = false; 3311 | } 3312 | return obj; 3313 | } 3314 | function go_complementMousewheelObject($tt, obj) { 3315 | return obj; 3316 | } 3317 | 3318 | // get number functions 3319 | function gn_getItemIndex(num, dev, org, items, $cfs) { 3320 | if (is_string(num)) 3321 | { 3322 | num = $(num, $cfs); 3323 | } 3324 | 3325 | if (is_object(num)) 3326 | { 3327 | num = $(num, $cfs); 3328 | } 3329 | if (is_jquery(num)) 3330 | { 3331 | num = $cfs.children().index(num); 3332 | if (!is_boolean(org)) 3333 | { 3334 | org = false; 3335 | } 3336 | } 3337 | else 3338 | { 3339 | if (!is_boolean(org)) 3340 | { 3341 | org = true; 3342 | } 3343 | } 3344 | if (!is_number(num)) 3345 | { 3346 | num = 0; 3347 | } 3348 | if (!is_number(dev)) 3349 | { 3350 | dev = 0; 3351 | } 3352 | 3353 | if (org) 3354 | { 3355 | num += items.first; 3356 | } 3357 | num += dev; 3358 | if (items.total > 0) 3359 | { 3360 | while (num >= items.total) 3361 | { 3362 | num -= items.total; 3363 | } 3364 | while (num < 0) 3365 | { 3366 | num += items.total; 3367 | } 3368 | } 3369 | return num; 3370 | } 3371 | 3372 | // items prev 3373 | function gn_getVisibleItemsPrev(i, o, s) { 3374 | var t = 0, 3375 | x = 0; 3376 | 3377 | for (var a = s; a >= 0; a--) 3378 | { 3379 | var j = i.eq(a); 3380 | t += (j.is(':visible')) ? j[o.d['outerWidth']](true) : 0; 3381 | if (t > o.maxDimension) 3382 | { 3383 | return x; 3384 | } 3385 | if (a == 0) 3386 | { 3387 | a = i.length; 3388 | } 3389 | x++; 3390 | } 3391 | } 3392 | function gn_getVisibleItemsPrevFilter(i, o, s) { 3393 | return gn_getItemsPrevFilter(i, o.items.filter, o.items.visibleConf.org, s); 3394 | } 3395 | function gn_getScrollItemsPrevFilter(i, o, s, m) { 3396 | return gn_getItemsPrevFilter(i, o.items.filter, m, s); 3397 | } 3398 | function gn_getItemsPrevFilter(i, f, m, s) { 3399 | var t = 0, 3400 | x = 0; 3401 | 3402 | for (var a = s, l = i.length; a >= 0; a--) 3403 | { 3404 | x++; 3405 | if (x == l) 3406 | { 3407 | return x; 3408 | } 3409 | 3410 | var j = i.eq(a); 3411 | if (j.is(f)) 3412 | { 3413 | t++; 3414 | if (t == m) 3415 | { 3416 | return x; 3417 | } 3418 | } 3419 | if (a == 0) 3420 | { 3421 | a = l; 3422 | } 3423 | } 3424 | } 3425 | 3426 | function gn_getVisibleOrg($c, o) { 3427 | return o.items.visibleConf.org || $c.children().slice(0, o.items.visible).filter(o.items.filter).length; 3428 | } 3429 | 3430 | // items next 3431 | function gn_getVisibleItemsNext(i, o, s) { 3432 | var t = 0, 3433 | x = 0; 3434 | 3435 | for (var a = s, l = i.length-1; a <= l; a++) 3436 | { 3437 | var j = i.eq(a); 3438 | 3439 | t += (j.is(':visible')) ? j[o.d['outerWidth']](true) : 0; 3440 | if (t > o.maxDimension) 3441 | { 3442 | return x; 3443 | } 3444 | 3445 | x++; 3446 | if (x == l+1) 3447 | { 3448 | return x; 3449 | } 3450 | if (a == l) 3451 | { 3452 | a = -1; 3453 | } 3454 | } 3455 | } 3456 | function gn_getVisibleItemsNextTestCircular(i, o, s, l) { 3457 | var v = gn_getVisibleItemsNext(i, o, s); 3458 | if (!o.circular) 3459 | { 3460 | if (s + v > l) 3461 | { 3462 | v = l - s; 3463 | } 3464 | } 3465 | return v; 3466 | } 3467 | function gn_getVisibleItemsNextFilter(i, o, s) { 3468 | return gn_getItemsNextFilter(i, o.items.filter, o.items.visibleConf.org, s, o.circular); 3469 | } 3470 | function gn_getScrollItemsNextFilter(i, o, s, m) { 3471 | return gn_getItemsNextFilter(i, o.items.filter, m+1, s, o.circular) - 1; 3472 | } 3473 | function gn_getItemsNextFilter(i, f, m, s, c) { 3474 | var t = 0, 3475 | x = 0; 3476 | 3477 | for (var a = s, l = i.length-1; a <= l; a++) 3478 | { 3479 | x++; 3480 | if (x >= l) 3481 | { 3482 | return x; 3483 | } 3484 | 3485 | var j = i.eq(a); 3486 | if (j.is(f)) 3487 | { 3488 | t++; 3489 | if (t == m) 3490 | { 3491 | return x; 3492 | } 3493 | } 3494 | if (a == l) 3495 | { 3496 | a = -1; 3497 | } 3498 | } 3499 | } 3500 | 3501 | // get items functions 3502 | function gi_getCurrentItems(i, o) { 3503 | return i.slice(0, o.items.visible); 3504 | } 3505 | function gi_getOldItemsPrev(i, o, n) { 3506 | return i.slice(n, o.items.visibleConf.old+n); 3507 | } 3508 | function gi_getNewItemsPrev(i, o) { 3509 | return i.slice(0, o.items.visible); 3510 | } 3511 | function gi_getOldItemsNext(i, o) { 3512 | return i.slice(0, o.items.visibleConf.old); 3513 | } 3514 | function gi_getNewItemsNext(i, o, n) { 3515 | return i.slice(n, o.items.visible+n); 3516 | } 3517 | 3518 | // sizes functions 3519 | function sz_storeMargin(i, o, d) { 3520 | if (o.usePadding) 3521 | { 3522 | if (!is_string(d)) 3523 | { 3524 | d = '_cfs_origCssMargin'; 3525 | } 3526 | i.each(function() { 3527 | var j = $(this), 3528 | m = parseInt(j.css(o.d['marginRight']), 10); 3529 | if (!is_number(m)) 3530 | { 3531 | m = 0; 3532 | } 3533 | j.data(d, m); 3534 | }); 3535 | } 3536 | } 3537 | function sz_resetMargin(i, o, m) { 3538 | if (o.usePadding) 3539 | { 3540 | var x = (is_boolean(m)) ? m : false; 3541 | if (!is_number(m)) 3542 | { 3543 | m = 0; 3544 | } 3545 | sz_storeMargin(i, o, '_cfs_tempCssMargin'); 3546 | i.each(function() { 3547 | var j = $(this); 3548 | j.css(o.d['marginRight'], ((x) ? j.data('_cfs_tempCssMargin') : m + j.data('_cfs_origCssMargin'))); 3549 | }); 3550 | } 3551 | } 3552 | function sz_storeOrigCss(i) { 3553 | i.each(function() { 3554 | var j = $(this); 3555 | j.data('_cfs_origCss', j.attr('style') || ''); 3556 | }); 3557 | } 3558 | function sz_restoreOrigCss(i) { 3559 | i.each(function() { 3560 | var j = $(this); 3561 | j.attr('style', j.data('_cfs_origCss') || ''); 3562 | }); 3563 | } 3564 | function sz_setResponsiveSizes(o, all) { 3565 | var visb = o.items.visible, 3566 | newS = o.items[o.d['width']], 3567 | seco = o[o.d['height']], 3568 | secp = is_percentage(seco); 3569 | 3570 | all.each(function() { 3571 | var $t = $(this), 3572 | nw = newS - ms_getPaddingBorderMargin($t, o, 'Width'); 3573 | 3574 | $t[o.d['width']](nw); 3575 | if (secp) 3576 | { 3577 | $t[o.d['height']](ms_getPercentage(nw, seco)); 3578 | } 3579 | }); 3580 | } 3581 | function sz_setSizes($c, o) { 3582 | var $w = $c.parent(), 3583 | $i = $c.children(), 3584 | $v = gi_getCurrentItems($i, o), 3585 | sz = cf_mapWrapperSizes(ms_getSizes($v, o, true), o, false); 3586 | 3587 | $w.css(sz); 3588 | 3589 | if (o.usePadding) 3590 | { 3591 | var p = o.padding, 3592 | r = p[o.d[1]]; 3593 | 3594 | if (o.align && r < 0) 3595 | { 3596 | r = 0; 3597 | } 3598 | var $l = $v.last(); 3599 | $l.css(o.d['marginRight'], $l.data('_cfs_origCssMargin') + r); 3600 | $c.css(o.d['top'], p[o.d[0]]); 3601 | $c.css(o.d['left'], p[o.d[3]]); 3602 | } 3603 | 3604 | $c.css(o.d['width'], sz[o.d['width']]+(ms_getTotalSize($i, o, 'width')*2)); 3605 | $c.css(o.d['height'], ms_getLargestSize($i, o, 'height')); 3606 | return sz; 3607 | } 3608 | 3609 | // measuring functions 3610 | function ms_getSizes(i, o, wrapper) { 3611 | return [ms_getTotalSize(i, o, 'width', wrapper), ms_getLargestSize(i, o, 'height', wrapper)]; 3612 | } 3613 | function ms_getLargestSize(i, o, dim, wrapper) { 3614 | if (!is_boolean(wrapper)) 3615 | { 3616 | wrapper = false; 3617 | } 3618 | if (is_number(o[o.d[dim]]) && wrapper) 3619 | { 3620 | return o[o.d[dim]]; 3621 | } 3622 | if (is_number(o.items[o.d[dim]])) 3623 | { 3624 | return o.items[o.d[dim]]; 3625 | } 3626 | dim = (dim.toLowerCase().indexOf('width') > -1) ? 'outerWidth' : 'outerHeight'; 3627 | return ms_getTrueLargestSize(i, o, dim); 3628 | } 3629 | function ms_getTrueLargestSize(i, o, dim) { 3630 | var s = 0; 3631 | 3632 | for (var a = 0, l = i.length; a < l; a++) 3633 | { 3634 | var j = i.eq(a); 3635 | 3636 | var m = (j.is(':visible')) ? j[o.d[dim]](true) : 0; 3637 | if (s < m) 3638 | { 3639 | s = m; 3640 | } 3641 | } 3642 | return s; 3643 | } 3644 | 3645 | function ms_getTotalSize(i, o, dim, wrapper) { 3646 | if (!is_boolean(wrapper)) 3647 | { 3648 | wrapper = false; 3649 | } 3650 | if (is_number(o[o.d[dim]]) && wrapper) 3651 | { 3652 | return o[o.d[dim]]; 3653 | } 3654 | if (is_number(o.items[o.d[dim]])) 3655 | { 3656 | return o.items[o.d[dim]] * i.length; 3657 | } 3658 | 3659 | var d = (dim.toLowerCase().indexOf('width') > -1) ? 'outerWidth' : 'outerHeight', 3660 | s = 0; 3661 | 3662 | for (var a = 0, l = i.length; a < l; a++) 3663 | { 3664 | var j = i.eq(a); 3665 | s += (j.is(':visible')) ? j[o.d[d]](true) : 0; 3666 | } 3667 | return s; 3668 | } 3669 | function ms_getParentSize($w, o, d) { 3670 | var isVisible = $w.is(':visible'); 3671 | if (isVisible) 3672 | { 3673 | $w.hide(); 3674 | } 3675 | var s = $w.parent()[o.d[d]](); 3676 | if (isVisible) 3677 | { 3678 | $w.show(); 3679 | } 3680 | return s; 3681 | } 3682 | function ms_getMaxDimension(o, a) { 3683 | return (is_number(o[o.d['width']])) ? o[o.d['width']] : a; 3684 | } 3685 | function ms_hasVariableSizes(i, o, dim) { 3686 | var s = false, 3687 | v = false; 3688 | 3689 | for (var a = 0, l = i.length; a < l; a++) 3690 | { 3691 | var j = i.eq(a); 3692 | 3693 | var c = (j.is(':visible')) ? j[o.d[dim]](true) : 0; 3694 | if (s === false) 3695 | { 3696 | s = c; 3697 | } 3698 | else if (s != c) 3699 | { 3700 | v = true; 3701 | } 3702 | if (s == 0) 3703 | { 3704 | v = true; 3705 | } 3706 | } 3707 | return v; 3708 | } 3709 | function ms_getPaddingBorderMargin(i, o, d) { 3710 | return i[o.d['outer'+d]](true) - i[o.d[d.toLowerCase()]](); 3711 | } 3712 | function ms_getPercentage(s, o) { 3713 | if (is_percentage(o)) 3714 | { 3715 | o = parseInt( o.slice(0, -1), 10 ); 3716 | if (!is_number(o)) 3717 | { 3718 | return s; 3719 | } 3720 | s *= o/100; 3721 | } 3722 | return s; 3723 | } 3724 | 3725 | // config functions 3726 | function cf_e(n, c, pf, ns, rd) { 3727 | if (!is_boolean(pf)) 3728 | { 3729 | pf = true; 3730 | } 3731 | if (!is_boolean(ns)) 3732 | { 3733 | ns = true; 3734 | } 3735 | if (!is_boolean(rd)) 3736 | { 3737 | rd = false; 3738 | } 3739 | 3740 | if (pf) 3741 | { 3742 | n = c.events.prefix + n; 3743 | } 3744 | if (ns) 3745 | { 3746 | n = n +'.'+ c.events.namespace; 3747 | } 3748 | if (ns && rd) 3749 | { 3750 | n += c.serialNumber; 3751 | } 3752 | 3753 | return n; 3754 | } 3755 | function cf_c(n, c) { 3756 | return (is_string(c.classnames[n])) ? c.classnames[n] : n; 3757 | } 3758 | function cf_mapWrapperSizes(ws, o, p) { 3759 | if (!is_boolean(p)) 3760 | { 3761 | p = true; 3762 | } 3763 | var pad = (o.usePadding && p) ? o.padding : [0, 0, 0, 0]; 3764 | var wra = {}; 3765 | 3766 | wra[o.d['width']] = ws[0] + pad[1] + pad[3]; 3767 | wra[o.d['height']] = ws[1] + pad[0] + pad[2]; 3768 | 3769 | return wra; 3770 | } 3771 | function cf_sortParams(vals, typs) { 3772 | var arr = []; 3773 | for (var a = 0, l1 = vals.length; a < l1; a++) 3774 | { 3775 | for (var b = 0, l2 = typs.length; b < l2; b++) 3776 | { 3777 | if (typs[b].indexOf(typeof vals[a]) > -1 && is_undefined(arr[b])) 3778 | { 3779 | arr[b] = vals[a]; 3780 | break; 3781 | } 3782 | } 3783 | } 3784 | return arr; 3785 | } 3786 | function cf_getPadding(p) { 3787 | if (is_undefined(p)) 3788 | { 3789 | return [0, 0, 0, 0]; 3790 | } 3791 | if (is_number(p)) 3792 | { 3793 | return [p, p, p, p]; 3794 | } 3795 | if (is_string(p)) 3796 | { 3797 | p = p.split('px').join('').split('em').join('').split(' '); 3798 | } 3799 | 3800 | if (!is_array(p)) 3801 | { 3802 | return [0, 0, 0, 0]; 3803 | } 3804 | for (var i = 0; i < 4; i++) 3805 | { 3806 | p[i] = parseInt(p[i], 10); 3807 | } 3808 | switch (p.length) 3809 | { 3810 | case 0: 3811 | return [0, 0, 0, 0]; 3812 | case 1: 3813 | return [p[0], p[0], p[0], p[0]]; 3814 | case 2: 3815 | return [p[0], p[1], p[0], p[1]]; 3816 | case 3: 3817 | return [p[0], p[1], p[2], p[1]]; 3818 | default: 3819 | return [p[0], p[1], p[2], p[3]]; 3820 | } 3821 | } 3822 | function cf_getAlignPadding(itm, o) { 3823 | var x = (is_number(o[o.d['width']])) ? Math.ceil(o[o.d['width']] - ms_getTotalSize(itm, o, 'width')) : 0; 3824 | switch (o.align) 3825 | { 3826 | case 'left': 3827 | return [0, x]; 3828 | case 'right': 3829 | return [x, 0]; 3830 | case 'center': 3831 | default: 3832 | return [Math.ceil(x/2), Math.floor(x/2)]; 3833 | } 3834 | } 3835 | function cf_getDimensions(o) { 3836 | var dm = [ 3837 | ['width' , 'innerWidth' , 'outerWidth' , 'height' , 'innerHeight' , 'outerHeight' , 'left', 'top' , 'marginRight' , 0, 1, 2, 3], 3838 | ['height' , 'innerHeight' , 'outerHeight' , 'width' , 'innerWidth' , 'outerWidth' , 'top' , 'left', 'marginBottom', 3, 2, 1, 0] 3839 | ]; 3840 | 3841 | var dl = dm[0].length, 3842 | dx = (o.direction == 'right' || o.direction == 'left') ? 0 : 1; 3843 | 3844 | var dimensions = {}; 3845 | for (var d = 0; d < dl; d++) 3846 | { 3847 | dimensions[dm[0][d]] = dm[dx][d]; 3848 | } 3849 | return dimensions; 3850 | } 3851 | function cf_getAdjust(x, o, a, $t) { 3852 | var v = x; 3853 | if (is_function(a)) 3854 | { 3855 | v = a.call($t, v); 3856 | 3857 | } 3858 | else if (is_string(a)) 3859 | { 3860 | var p = a.split('+'), 3861 | m = a.split('-'); 3862 | 3863 | if (m.length > p.length) 3864 | { 3865 | var neg = true, 3866 | sta = m[0], 3867 | adj = m[1]; 3868 | } 3869 | else 3870 | { 3871 | var neg = false, 3872 | sta = p[0], 3873 | adj = p[1]; 3874 | } 3875 | 3876 | switch(sta) 3877 | { 3878 | case 'even': 3879 | v = (x % 2 == 1) ? x-1 : x; 3880 | break; 3881 | case 'odd': 3882 | v = (x % 2 == 0) ? x-1 : x; 3883 | break; 3884 | default: 3885 | v = x; 3886 | break; 3887 | } 3888 | adj = parseInt(adj, 10); 3889 | if (is_number(adj)) 3890 | { 3891 | if (neg) 3892 | { 3893 | adj = -adj; 3894 | } 3895 | v += adj; 3896 | } 3897 | } 3898 | if (!is_number(v) || v < 1) 3899 | { 3900 | v = 1; 3901 | } 3902 | return v; 3903 | } 3904 | function cf_getItemsAdjust(x, o, a, $t) { 3905 | return cf_getItemAdjustMinMax(cf_getAdjust(x, o, a, $t), o.items.visibleConf); 3906 | } 3907 | function cf_getItemAdjustMinMax(v, i) { 3908 | if (is_number(i.min) && v < i.min) 3909 | { 3910 | v = i.min; 3911 | } 3912 | if (is_number(i.max) && v > i.max) 3913 | { 3914 | v = i.max; 3915 | } 3916 | if (v < 1) 3917 | { 3918 | v = 1; 3919 | } 3920 | return v; 3921 | } 3922 | function cf_getSynchArr(s) { 3923 | if (!is_array(s)) 3924 | { 3925 | s = [[s]]; 3926 | } 3927 | if (!is_array(s[0])) 3928 | { 3929 | s = [s]; 3930 | } 3931 | for (var j = 0, l = s.length; j < l; j++) 3932 | { 3933 | if (is_string(s[j][0])) 3934 | { 3935 | s[j][0] = $(s[j][0]); 3936 | } 3937 | if (!is_boolean(s[j][1])) 3938 | { 3939 | s[j][1] = true; 3940 | } 3941 | if (!is_boolean(s[j][2])) 3942 | { 3943 | s[j][2] = true; 3944 | } 3945 | if (!is_number(s[j][3])) 3946 | { 3947 | s[j][3] = 0; 3948 | } 3949 | } 3950 | return s; 3951 | } 3952 | function cf_getKeyCode(k) { 3953 | if (k == 'right') 3954 | { 3955 | return 39; 3956 | } 3957 | if (k == 'left') 3958 | { 3959 | return 37; 3960 | } 3961 | if (k == 'up') 3962 | { 3963 | return 38; 3964 | } 3965 | if (k == 'down') 3966 | { 3967 | return 40; 3968 | } 3969 | return -1; 3970 | } 3971 | function cf_setCookie(n, $c, c) { 3972 | if (n) 3973 | { 3974 | var v = $c.triggerHandler(cf_e('currentPosition', c)); 3975 | $.fn.carouFredSel.cookie.set(n, v); 3976 | } 3977 | } 3978 | function cf_getCookie(n) { 3979 | var c = $.fn.carouFredSel.cookie.get(n); 3980 | return (c == '') ? 0 : c; 3981 | } 3982 | 3983 | // init function 3984 | function in_mapCss($elem, props) { 3985 | var css = {}; 3986 | for (var p = 0, l = props.length; p < l; p++) 3987 | { 3988 | css[props[p]] = $elem.css(props[p]); 3989 | } 3990 | return css; 3991 | } 3992 | function in_complementItems(obj, opt, itm, sta) { 3993 | if (!is_object(obj.visibleConf)) 3994 | { 3995 | obj.visibleConf = {}; 3996 | } 3997 | if (!is_object(obj.sizesConf)) 3998 | { 3999 | obj.sizesConf = {}; 4000 | } 4001 | 4002 | if (obj.start == 0 && is_number(sta)) 4003 | { 4004 | obj.start = sta; 4005 | } 4006 | 4007 | // visible items 4008 | if (is_object(obj.visible)) 4009 | { 4010 | obj.visibleConf.min = obj.visible.min; 4011 | obj.visibleConf.max = obj.visible.max; 4012 | obj.visible = false; 4013 | } 4014 | else if (is_string(obj.visible)) 4015 | { 4016 | // variable visible items 4017 | if (obj.visible == 'variable') 4018 | { 4019 | obj.visibleConf.variable = true; 4020 | } 4021 | // adjust string visible items 4022 | else 4023 | { 4024 | obj.visibleConf.adjust = obj.visible; 4025 | } 4026 | obj.visible = false; 4027 | } 4028 | else if (is_function(obj.visible)) 4029 | { 4030 | obj.visibleConf.adjust = obj.visible; 4031 | obj.visible = false; 4032 | } 4033 | 4034 | // set items filter 4035 | if (!is_string(obj.filter)) 4036 | { 4037 | obj.filter = (itm.filter(':hidden').length > 0) ? ':visible' : '*'; 4038 | } 4039 | 4040 | // primary item-size not set 4041 | if (!obj[opt.d['width']]) 4042 | { 4043 | // responsive carousel -> set to largest 4044 | if (opt.responsive) 4045 | { 4046 | debug(true, 'Set a '+opt.d['width']+' for the items!'); 4047 | obj[opt.d['width']] = ms_getTrueLargestSize(itm, opt, 'outerWidth'); 4048 | } 4049 | // non-responsive -> measure it or set to "variable" 4050 | else 4051 | { 4052 | obj[opt.d['width']] = (ms_hasVariableSizes(itm, opt, 'outerWidth')) 4053 | ? 'variable' 4054 | : itm[opt.d['outerWidth']](true); 4055 | } 4056 | } 4057 | 4058 | // secondary item-size not set -> measure it or set to "variable" 4059 | if (!obj[opt.d['height']]) 4060 | { 4061 | obj[opt.d['height']] = (ms_hasVariableSizes(itm, opt, 'outerHeight')) 4062 | ? 'variable' 4063 | : itm[opt.d['outerHeight']](true); 4064 | } 4065 | 4066 | obj.sizesConf.width = obj.width; 4067 | obj.sizesConf.height = obj.height; 4068 | return obj; 4069 | } 4070 | function in_complementVisibleItems(opt, avl) { 4071 | // primary item-size variable -> set visible items variable 4072 | if (opt.items[opt.d['width']] == 'variable') 4073 | { 4074 | opt.items.visibleConf.variable = true; 4075 | } 4076 | if (!opt.items.visibleConf.variable) { 4077 | // primary size is number -> calculate visible-items 4078 | if (is_number(opt[opt.d['width']])) 4079 | { 4080 | opt.items.visible = Math.floor(opt[opt.d['width']] / opt.items[opt.d['width']]); 4081 | } 4082 | // measure and calculate primary size and visible-items 4083 | else 4084 | { 4085 | opt.items.visible = Math.floor(avl / opt.items[opt.d['width']]); 4086 | opt[opt.d['width']] = opt.items.visible * opt.items[opt.d['width']]; 4087 | if (!opt.items.visibleConf.adjust) 4088 | { 4089 | opt.align = false; 4090 | } 4091 | } 4092 | if (opt.items.visible == 'Infinity' || opt.items.visible < 1) 4093 | { 4094 | debug(true, 'Not a valid number of visible items: Set to "variable".'); 4095 | opt.items.visibleConf.variable = true; 4096 | } 4097 | } 4098 | return opt; 4099 | } 4100 | function in_complementPrimarySize(obj, opt, all) { 4101 | // primary size set to auto -> measure largest item-size and set it 4102 | if (obj == 'auto') 4103 | { 4104 | obj = ms_getTrueLargestSize(all, opt, 'outerWidth'); 4105 | } 4106 | return obj; 4107 | } 4108 | function in_complementSecondarySize(obj, opt, all) { 4109 | // secondary size set to auto -> measure largest item-size and set it 4110 | if (obj == 'auto') 4111 | { 4112 | obj = ms_getTrueLargestSize(all, opt, 'outerHeight'); 4113 | } 4114 | // secondary size not set -> set to secondary item-size 4115 | if (!obj) 4116 | { 4117 | obj = opt.items[opt.d['height']]; 4118 | } 4119 | return obj; 4120 | } 4121 | function in_getAlignPadding(o, all) { 4122 | var p = cf_getAlignPadding(gi_getCurrentItems(all, o), o); 4123 | o.padding[o.d[1]] = p[1]; 4124 | o.padding[o.d[3]] = p[0]; 4125 | return o; 4126 | } 4127 | function in_getResponsiveValues(o, all, avl) { 4128 | 4129 | var visb = cf_getItemAdjustMinMax(Math.ceil(o[o.d['width']] / o.items[o.d['width']]), o.items.visibleConf); 4130 | if (visb > all.length) 4131 | { 4132 | visb = all.length; 4133 | } 4134 | 4135 | var newS = Math.floor(o[o.d['width']]/visb); 4136 | 4137 | o.items.visible = visb; 4138 | o.items[o.d['width']] = newS; 4139 | o[o.d['width']] = visb * newS; 4140 | return o; 4141 | } 4142 | 4143 | 4144 | // buttons functions 4145 | function bt_pauseOnHoverConfig(p) { 4146 | if (is_string(p)) 4147 | { 4148 | var i = (p.indexOf('immediate') > -1) ? true : false, 4149 | r = (p.indexOf('resume') > -1) ? true : false; 4150 | } 4151 | else 4152 | { 4153 | var i = r = false; 4154 | } 4155 | return [i, r]; 4156 | } 4157 | function bt_mousesheelNumber(mw) { 4158 | return (is_number(mw)) ? mw : null 4159 | } 4160 | 4161 | // helper functions 4162 | function is_null(a) { 4163 | return (a === null); 4164 | } 4165 | function is_undefined(a) { 4166 | return (is_null(a) || typeof a == 'undefined' || a === '' || a === 'undefined'); 4167 | } 4168 | function is_array(a) { 4169 | return (a instanceof Array); 4170 | } 4171 | function is_jquery(a) { 4172 | return (a instanceof jQuery); 4173 | } 4174 | function is_object(a) { 4175 | return ((a instanceof Object || typeof a == 'object') && !is_null(a) && !is_jquery(a) && !is_array(a) && !is_function(a)); 4176 | } 4177 | function is_number(a) { 4178 | return ((a instanceof Number || typeof a == 'number') && !isNaN(a)); 4179 | } 4180 | function is_string(a) { 4181 | return ((a instanceof String || typeof a == 'string') && !is_undefined(a) && !is_true(a) && !is_false(a)); 4182 | } 4183 | function is_function(a) { 4184 | return (a instanceof Function || typeof a == 'function'); 4185 | } 4186 | function is_boolean(a) { 4187 | return (a instanceof Boolean || typeof a == 'boolean' || is_true(a) || is_false(a)); 4188 | } 4189 | function is_true(a) { 4190 | return (a === true || a === 'true'); 4191 | } 4192 | function is_false(a) { 4193 | return (a === false || a === 'false'); 4194 | } 4195 | function is_percentage(x) { 4196 | return (is_string(x) && x.slice(-1) == '%'); 4197 | } 4198 | 4199 | 4200 | function getTime() { 4201 | return new Date().getTime(); 4202 | } 4203 | 4204 | function deprecated( o, n ) { 4205 | debug(true, o+' is DEPRECATED, support for it will be removed. Use '+n+' instead.'); 4206 | } 4207 | function debug(d, m) { 4208 | if (!is_undefined(window.console) && !is_undefined(window.console.log)) 4209 | { 4210 | if (is_object(d)) 4211 | { 4212 | var s = ' ('+d.selector+')'; 4213 | d = d.debug; 4214 | } 4215 | else 4216 | { 4217 | var s = ''; 4218 | } 4219 | if (!d) 4220 | { 4221 | return false; 4222 | } 4223 | 4224 | if (is_string(m)) 4225 | { 4226 | m = 'carouFredSel'+s+': ' + m; 4227 | } 4228 | else 4229 | { 4230 | m = ['carouFredSel'+s+':', m]; 4231 | } 4232 | window.console.log(m); 4233 | } 4234 | return false; 4235 | } 4236 | 4237 | 4238 | 4239 | // EASING FUNCTIONS 4240 | $.extend($.easing, { 4241 | 'quadratic': function(t) { 4242 | var t2 = t * t; 4243 | return t * (-t2 * t + 4 * t2 - 6 * t + 4); 4244 | }, 4245 | 'cubic': function(t) { 4246 | return t * (4 * t * t - 9 * t + 6); 4247 | }, 4248 | 'elastic': function(t) { 4249 | var t2 = t * t; 4250 | return t * (33 * t2 * t2 - 106 * t2 * t + 126 * t2 - 67 * t + 15); 4251 | } 4252 | }); 4253 | 4254 | 4255 | })(jQuery); -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Dev7studios 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | This program is free software; you can redistribute it and/or modify 25 | it under the terms of the GNU General Public License as published by 26 | the Free Software Foundation; either version 2 of the License, or 27 | (at your option) any later version. 28 | 29 | This program is distributed in the hope that it will be useful, 30 | but WITHOUT ANY WARRANTY; without even the implied warranty of 31 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 32 | GNU General Public License for more details. 33 | 34 | You should have received a copy of the GNU General Public License along 35 | with this program; if not, write to the Free Software Foundation, Inc., 36 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 37 | --------------------------------------------------------------------------------