/*Bootstrap Carousel Touch Slider. http://bootstrapthemes.co Credits: Bootstrap, jQuery, TouchSwipe, Animate.css, FontAwesome */ (function(a){if(typeof define==="function"&&define.amd&&define.amd.jQuery){define(["jquery"],a)}else{if(typeof module!=="undefined"&&module.exports){a(require("jquery"))}else{a(jQuery)}}}(function(f){var y="1.6.15",p="left",o="right",e="up",x="down",c="in",A="out",m="none",s="auto",l="swipe",t="pinch",B="tap",j="doubletap",b="longtap",z="hold",E="horizontal",u="vertical",i="all",r=10,g="start",k="move",h="end",q="cancel",a="ontouchstart" in window,v=window.navigator.msPointerEnabled&&!window.navigator.pointerEnabled&&!a,d=(window.navigator.pointerEnabled||window.navigator.msPointerEnabled)&&!a,C="TouchSwipe";var n={fingers:1,threshold:75,cancelThreshold:null,pinchThreshold:20,maxTimeThreshold:null,fingerReleaseThreshold:250,longTapThreshold:500,doubleTapThreshold:200,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,tap:null,doubleTap:null,longTap:null,hold:null,triggerOnTouchEnd:true,triggerOnTouchLeave:false,allowPageScroll:"auto",fallbackToMouseEvents:true,excludedElements:"label, button, input, select, textarea, a, .noSwipe",preventDefaultEvents:true};f.fn.swipe=function(H){var G=f(this),F=G.data(C);if(F&&typeof H==="string"){if(F[H]){return F[H].apply(this,Array.prototype.slice.call(arguments,1))}else{f.error("Method "+H+" does not exist on jQuery.swipe")}}else{if(F&&typeof H==="object"){F.option.apply(this,arguments)}else{if(!F&&(typeof H==="object"||!H)){return w.apply(this,arguments)}}}return G};f.fn.swipe.version=y;f.fn.swipe.defaults=n;f.fn.swipe.phases={PHASE_START:g,PHASE_MOVE:k,PHASE_END:h,PHASE_CANCEL:q};f.fn.swipe.directions={LEFT:p,RIGHT:o,UP:e,DOWN:x,IN:c,OUT:A};f.fn.swipe.pageScroll={NONE:m,HORIZONTAL:E,VERTICAL:u,AUTO:s};f.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,FOUR:4,FIVE:5,ALL:i};function w(F){if(F&&(F.allowPageScroll===undefined&&(F.swipe!==undefined||F.swipeStatus!==undefined))){F.allowPageScroll=m}if(F.click!==undefined&&F.tap===undefined){F.tap=F.click}if(!F){F={}}F=f.extend({},f.fn.swipe.defaults,F);return this.each(function(){var H=f(this);var G=H.data(C);if(!G){G=new D(this,F);H.data(C,G)}})}function D(a5,au){var au=f.extend({},au);var az=(a||d||!au.fallbackToMouseEvents),K=az?(d?(v?"MSPointerDown":"pointerdown"):"touchstart"):"mousedown",ax=az?(d?(v?"MSPointerMove":"pointermove"):"touchmove"):"mousemove",V=az?(d?(v?"MSPointerUp":"pointerup"):"touchend"):"mouseup",T=az?(d?"mouseleave":null):"mouseleave",aD=(d?(v?"MSPointerCancel":"pointercancel"):"touchcancel");var ag=0,aP=null,a2=null,ac=0,a1=0,aZ=0,H=1,ap=0,aJ=0,N=null;var aR=f(a5);var aa="start";var X=0;var aQ={};var U=0,a3=0,a6=0,ay=0,O=0;var aW=null,af=null;try{aR.bind(K,aN);aR.bind(aD,ba)}catch(aj){f.error("events not supported "+K+","+aD+" on jQuery.swipe")}this.enable=function(){aR.bind(K,aN);aR.bind(aD,ba);return aR};this.disable=function(){aK();return aR};this.destroy=function(){aK();aR.data(C,null);aR=null};this.option=function(bd,bc){if(typeof bd==="object"){au=f.extend(au,bd)}else{if(au[bd]!==undefined){if(bc===undefined){return au[bd]}else{au[bd]=bc}}else{if(!bd){return au}else{f.error("Option "+bd+" does not exist on jQuery.swipe.options")}}}return null};function aN(be){if(aB()){return}if(f(be.target).closest(au.excludedElements,aR).length>0){return}var bf=be.originalEvent?be.originalEvent:be;var bd,bg=bf.touches,bc=bg?bg[0]:bf;aa=g;if(bg){X=bg.length}else{if(au.preventDefaultEvents!==false){be.preventDefault()}}ag=0;aP=null;a2=null;aJ=null;ac=0;a1=0;aZ=0;H=1;ap=0;N=ab();S();ai(0,bc);if(!bg||(X===au.fingers||au.fingers===i)||aX()){U=ar();if(X==2){ai(1,bg[1]);a1=aZ=at(aQ[0].start,aQ[1].start)}if(au.swipeStatus||au.pinchStatus){bd=P(bf,aa)}}else{bd=false}if(bd===false){aa=q;P(bf,aa);return bd}else{if(au.hold){af=setTimeout(f.proxy(function(){aR.trigger("hold",[bf.target]);if(au.hold){bd=au.hold.call(aR,bf,bf.target)}},this),au.longTapThreshold)}an(true)}return null}function a4(bf){var bi=bf.originalEvent?bf.originalEvent:bf;if(aa===h||aa===q||al()){return}var be,bj=bi.touches,bd=bj?bj[0]:bi;var bg=aH(bd);a3=ar();if(bj){X=bj.length}if(au.hold){clearTimeout(af)}aa=k;if(X==2){if(a1==0){ai(1,bj[1]);a1=aZ=at(aQ[0].start,aQ[1].start)}else{aH(bj[1]);aZ=at(aQ[0].end,aQ[1].end);aJ=aq(aQ[0].end,aQ[1].end)}H=a8(a1,aZ);ap=Math.abs(a1-aZ)}if((X===au.fingers||au.fingers===i)||!bj||aX()){aP=aL(bg.start,bg.end);a2=aL(bg.last,bg.end);ak(bf,a2);ag=aS(bg.start,bg.end);ac=aM();aI(aP,ag);be=P(bi,aa);if(!au.triggerOnTouchEnd||au.triggerOnTouchLeave){var bc=true;if(au.triggerOnTouchLeave){var bh=aY(this);bc=F(bg.end,bh)}if(!au.triggerOnTouchEnd&&bc){aa=aC(k)}else{if(au.triggerOnTouchLeave&&!bc){aa=aC(h)}}if(aa==q||aa==h){P(bi,aa)}}}else{aa=q;P(bi,aa)}if(be===false){aa=q;P(bi,aa)}}function M(bc){var bd=bc.originalEvent?bc.originalEvent:bc,be=bd.touches;if(be){if(be.length&&!al()){G(bd);return true}else{if(be.length&&al()){return true}}}if(al()){X=ay}a3=ar();ac=aM();if(bb()||!am()){aa=q;P(bd,aa)}else{if(au.triggerOnTouchEnd||(au.triggerOnTouchEnd==false&&aa===k)){if(au.preventDefaultEvents!==false){bc.preventDefault()}aa=h;P(bd,aa)}else{if(!au.triggerOnTouchEnd&&a7()){aa=h;aF(bd,aa,B)}else{if(aa===k){aa=q;P(bd,aa)}}}}an(false);return null}function ba(){X=0;a3=0;U=0;a1=0;aZ=0;H=1;S();an(false)}function L(bc){var bd=bc.originalEvent?bc.originalEvent:bc;if(au.triggerOnTouchLeave){aa=aC(h);P(bd,aa)}}function aK(){aR.unbind(K,aN);aR.unbind(aD,ba);aR.unbind(ax,a4);aR.unbind(V,M);if(T){aR.unbind(T,L)}an(false)}function aC(bg){var bf=bg;var be=aA();var bd=am();var bc=bb();if(!be||bc){bf=q}else{if(bd&&bg==k&&(!au.triggerOnTouchEnd||au.triggerOnTouchLeave)){bf=h}else{if(!bd&&bg==h&&au.triggerOnTouchLeave){bf=q}}}return bf}function P(be,bc){var bd,bf=be.touches;if(J()||W()){bd=aF(be,bc,l)}if((Q()||aX())&&bd!==false){bd=aF(be,bc,t)}if(aG()&&bd!==false){bd=aF(be,bc,j)}else{if(ao()&&bd!==false){bd=aF(be,bc,b)}else{if(ah()&&bd!==false){bd=aF(be,bc,B)}}}if(bc===q){if(W()){bd=aF(be,bc,l)}if(aX()){bd=aF(be,bc,t)}ba(be)}if(bc===h){if(bf){if(!bf.length){ba(be)}}else{ba(be)}}return bd}function aF(bf,bc,be){var bd;if(be==l){aR.trigger("swipeStatus",[bc,aP||null,ag||0,ac||0,X,aQ,a2]);if(au.swipeStatus){bd=au.swipeStatus.call(aR,bf,bc,aP||null,ag||0,ac||0,X,aQ,a2);if(bd===false){return false}}if(bc==h&&aV()){clearTimeout(aW);clearTimeout(af);aR.trigger("swipe",[aP,ag,ac,X,aQ,a2]);if(au.swipe){bd=au.swipe.call(aR,bf,aP,ag,ac,X,aQ,a2);if(bd===false){return false}}switch(aP){case p:aR.trigger("swipeLeft",[aP,ag,ac,X,aQ,a2]);if(au.swipeLeft){bd=au.swipeLeft.call(aR,bf,aP,ag,ac,X,aQ,a2)}break;case o:aR.trigger("swipeRight",[aP,ag,ac,X,aQ,a2]);if(au.swipeRight){bd=au.swipeRight.call(aR,bf,aP,ag,ac,X,aQ,a2)}break;case e:aR.trigger("swipeUp",[aP,ag,ac,X,aQ,a2]);if(au.swipeUp){bd=au.swipeUp.call(aR,bf,aP,ag,ac,X,aQ,a2)}break;case x:aR.trigger("swipeDown",[aP,ag,ac,X,aQ,a2]);if(au.swipeDown){bd=au.swipeDown.call(aR,bf,aP,ag,ac,X,aQ,a2)}break}}}if(be==t){aR.trigger("pinchStatus",[bc,aJ||null,ap||0,ac||0,X,H,aQ]);if(au.pinchStatus){bd=au.pinchStatus.call(aR,bf,bc,aJ||null,ap||0,ac||0,X,H,aQ);if(bd===false){return false}}if(bc==h&&a9()){switch(aJ){case c:aR.trigger("pinchIn",[aJ||null,ap||0,ac||0,X,H,aQ]);if(au.pinchIn){bd=au.pinchIn.call(aR,bf,aJ||null,ap||0,ac||0,X,H,aQ)}break;case A:aR.trigger("pinchOut",[aJ||null,ap||0,ac||0,X,H,aQ]);if(au.pinchOut){bd=au.pinchOut.call(aR,bf,aJ||null,ap||0,ac||0,X,H,aQ)}break}}}if(be==B){if(bc===q||bc===h){clearTimeout(aW);clearTimeout(af);if(Z()&&!I()){O=ar();aW=setTimeout(f.proxy(function(){O=null;aR.trigger("tap",[bf.target]);if(au.tap){bd=au.tap.call(aR,bf,bf.target)}},this),au.doubleTapThreshold)}else{O=null;aR.trigger("tap",[bf.target]);if(au.tap){bd=au.tap.call(aR,bf,bf.target)}}}}else{if(be==j){if(bc===q||bc===h){clearTimeout(aW);clearTimeout(af);O=null;aR.trigger("doubletap",[bf.target]);if(au.doubleTap){bd=au.doubleTap.call(aR,bf,bf.target)}}}else{if(be==b){if(bc===q||bc===h){clearTimeout(aW);O=null;aR.trigger("longtap",[bf.target]);if(au.longTap){bd=au.longTap.call(aR,bf,bf.target)}}}}}return bd}function am(){var bc=true;if(au.threshold!==null){bc=ag>=au.threshold}return bc}function bb(){var bc=false;if(au.cancelThreshold!==null&&aP!==null){bc=(aT(aP)-ag)>=au.cancelThreshold}return bc}function ae(){if(au.pinchThreshold!==null){return ap>=au.pinchThreshold}return true}function aA(){var bc;if(au.maxTimeThreshold){if(ac>=au.maxTimeThreshold){bc=false}else{bc=true}}else{bc=true}return bc}function ak(bc,bd){if(au.preventDefaultEvents===false){return}if(au.allowPageScroll===m){bc.preventDefault()}else{var be=au.allowPageScroll===s;switch(bd){case p:if((au.swipeLeft&&be)||(!be&&au.allowPageScroll!=E)){bc.preventDefault()}break;case o:if((au.swipeRight&&be)||(!be&&au.allowPageScroll!=E)){bc.preventDefault()}break;case e:if((au.swipeUp&&be)||(!be&&au.allowPageScroll!=u)){bc.preventDefault()}break;case x:if((au.swipeDown&&be)||(!be&&au.allowPageScroll!=u)){bc.preventDefault()}break}}}function a9(){var bd=aO();var bc=Y();var be=ae();return bd&&bc&&be}function aX(){return !!(au.pinchStatus||au.pinchIn||au.pinchOut)}function Q(){return !!(a9()&&aX())}function aV(){var bf=aA();var bh=am();var be=aO();var bc=Y();var bd=bb();var bg=!bd&&bc&&be&&bh&&bf;return bg}function W(){return !!(au.swipe||au.swipeStatus||au.swipeLeft||au.swipeRight||au.swipeUp||au.swipeDown)}function J(){return !!(aV()&&W())}function aO(){return((X===au.fingers||au.fingers===i)||!a)}function Y(){return aQ[0].end.x!==0}function a7(){return !!(au.tap)}function Z(){return !!(au.doubleTap)}function aU(){return !!(au.longTap)}function R(){if(O==null){return false}var bc=ar();return(Z()&&((bc-O)<=au.doubleTapThreshold))}function I(){return R()}function aw(){return((X===1||!a)&&(isNaN(ag)||agau.longTapThreshold)&&(ag=0)){return p}else{if((be<=360)&&(be>=315)){return p}else{if((be>=135)&&(be<=225)){return o}else{if((be>45)&&(be<135)){return x}else{return e}}}}}function ar(){var bc=new Date();return bc.getTime()}function aY(bc){bc=f(bc);var be=bc.offset();var bd={left:be.left,right:be.left+bc.outerWidth(),top:be.top,bottom:be.top+bc.outerHeight()};return bd}function F(bc,bd){return(bc.x>bd.left&&bc.xbd.top&&bc.y= window_top && top - ($element.data('appear-top-offset') || 0) <= window_top + $window.height() && left + $element.width() >= window_left && left - ($element.data('appear-left-offset') || 0) <= window_left + $window.width()) { return true; } else { return false; } } $.fn.extend({ // watching for element's appearance in browser viewport appear: function(options) { var opts = $.extend({}, defaults, options || {}); var selector = this.selector || this; if (!check_binded) { var on_check = function() { if (check_lock) { return; } check_lock = true; setTimeout(process, opts.interval); }; $(window).scroll(on_check).resize(on_check); check_binded = true; } if (opts.force_process) { setTimeout(process, opts.interval); } selectors.push(selector); return $(selector); } }); $.extend({ // force elements's appearance check force_appear: function() { if (check_binded) { process(); return true; }; return false; } }); })(jQuery); /*! * jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010 * http://benalman.com/projects/jquery-dotimeout-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ // Script: jQuery doTimeout: Like setTimeout, but better! // // *Version: 1.0, Last updated: 3/3/2010* // // Project Home - http://benalman.com/projects/jquery-dotimeout-plugin/ // GitHub - http://github.com/cowboy/jquery-dotimeout/ // Source - http://github.com/cowboy/jquery-dotimeout/raw/master/jquery.ba-dotimeout.js // (Minified) - http://github.com/cowboy/jquery-dotimeout/raw/master/jquery.ba-dotimeout.min.js (1.0kb) // // About: License // // Copyright (c) 2010 "Cowboy" Ben Alman, // Dual licensed under the MIT and GPL licenses. // http://benalman.com/about/license/ // // About: Examples // // These working examples, complete with fully commented code, illustrate a few // ways in which this plugin can be used. // // Debouncing - http://benalman.com/code/projects/jquery-dotimeout/examples/debouncing/ // Delays, Polling - http://benalman.com/code/projects/jquery-dotimeout/examples/delay-poll/ // Hover Intent - http://benalman.com/code/projects/jquery-dotimeout/examples/hoverintent/ // // About: Support and Testing // // Information about what version or versions of jQuery this plugin has been // tested with, what browsers it has been tested in, and where the unit tests // reside (so you can test it yourself). // // jQuery Versions - 1.3.2, 1.4.2 // Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome 4-5, Opera 9.6-10.1. // Unit Tests - http://benalman.com/code/projects/jquery-dotimeout/unit/ // // About: Release History // // 1.0 - (3/3/2010) Callback can now be a string, in which case it will call // the appropriate $.method or $.fn.method, depending on where .doTimeout // was called. Callback must now return `true` (not just a truthy value) // to poll. // 0.4 - (7/15/2009) Made the "id" argument optional, some other minor tweaks // 0.3 - (6/25/2009) Initial release (function($){ '$:nomunge'; // Used by YUI compressor. var cache = {}, // Reused internal string. doTimeout = 'doTimeout', // A convenient shortcut. aps = Array.prototype.slice; // Method: jQuery.doTimeout // // Initialize, cancel, or force execution of a callback after a delay. // // If delay and callback are specified, a doTimeout is initialized. The // callback will execute, asynchronously, after the delay. If an id is // specified, this doTimeout will override and cancel any existing doTimeout // with the same id. Any additional arguments will be passed into callback // when it is executed. // // If the callback returns true, the doTimeout loop will execute again, after // the delay, creating a polling loop until the callback returns a non-true // value. // // Note that if an id is not passed as the first argument, this doTimeout will // NOT be able to be manually canceled or forced. (for debouncing, be sure to // specify an id). // // If id is specified, but delay and callback are not, the doTimeout will be // canceled without executing the callback. If force_mode is specified, the // callback will be executed, synchronously, but will only be allowed to // continue a polling loop if force_mode is true (provided the callback // returns true, of course). If force_mode is false, no polling loop will // continue, even if the callback returns true. // // Usage: // // > jQuery.doTimeout( [ id, ] delay, callback [, arg ... ] ); // > jQuery.doTimeout( id [, force_mode ] ); // // Arguments: // // id - (String) An optional unique identifier for this doTimeout. If id is // not specified, the doTimeout will NOT be able to be manually canceled or // forced. // delay - (Number) A zero-or-greater delay in milliseconds after which // callback will be executed. // callback - (Function) A function to be executed after delay milliseconds. // callback - (String) A jQuery method to be executed after delay // milliseconds. This method will only poll if it explicitly returns // true. // force_mode - (Boolean) If true, execute that id's doTimeout callback // immediately and synchronously, continuing any callback return-true // polling loop. If false, execute the callback immediately and // synchronously but do NOT continue a callback return-true polling loop. // If omitted, cancel that id's doTimeout. // // Returns: // // If force_mode is true, false or undefined and there is a // yet-to-be-executed callback to cancel, true is returned, but if no // callback remains to be executed, undefined is returned. $[doTimeout] = function() { return p_doTimeout.apply( window, [ 0 ].concat( aps.call( arguments ) ) ); }; // Method: jQuery.fn.doTimeout // // Initialize, cancel, or force execution of a callback after a delay. // Operates like , but the passed callback executes in the // context of the jQuery collection of elements, and the id is stored as data // on the first element in that collection. // // If delay and callback are specified, a doTimeout is initialized. The // callback will execute, asynchronously, after the delay. If an id is // specified, this doTimeout will override and cancel any existing doTimeout // with the same id. Any additional arguments will be passed into callback // when it is executed. // // If the callback returns true, the doTimeout loop will execute again, after // the delay, creating a polling loop until the callback returns a non-true // value. // // Note that if an id is not passed as the first argument, this doTimeout will // NOT be able to be manually canceled or forced (for debouncing, be sure to // specify an id). // // If id is specified, but delay and callback are not, the doTimeout will be // canceled without executing the callback. If force_mode is specified, the // callback will be executed, synchronously, but will only be allowed to // continue a polling loop if force_mode is true (provided the callback // returns true, of course). If force_mode is false, no polling loop will // continue, even if the callback returns true. // // Usage: // // > jQuery('selector').doTimeout( [ id, ] delay, callback [, arg ... ] ); // > jQuery('selector').doTimeout( id [, force_mode ] ); // // Arguments: // // id - (String) An optional unique identifier for this doTimeout, stored as // jQuery data on the element. If id is not specified, the doTimeout will // NOT be able to be manually canceled or forced. // delay - (Number) A zero-or-greater delay in milliseconds after which // callback will be executed. // callback - (Function) A function to be executed after delay milliseconds. // callback - (String) A jQuery.fn method to be executed after delay // milliseconds. This method will only poll if it explicitly returns // true (most jQuery.fn methods return a jQuery object, and not `true`, // which allows them to be chained and prevents polling). // force_mode - (Boolean) If true, execute that id's doTimeout callback // immediately and synchronously, continuing any callback return-true // polling loop. If false, execute the callback immediately and // synchronously but do NOT continue a callback return-true polling loop. // If omitted, cancel that id's doTimeout. // // Returns: // // When creating a , the initial jQuery collection of // elements is returned. Otherwise, if force_mode is true, false or undefined // and there is a yet-to-be-executed callback to cancel, true is returned, // but if no callback remains to be executed, undefined is returned. $.fn[doTimeout] = function() { var args = aps.call( arguments ), result = p_doTimeout.apply( this, [ doTimeout + args[0] ].concat( args ) ); return typeof args[0] === 'number' || typeof args[1] === 'number' ? this : result; }; function p_doTimeout( jquery_data_key ) { var that = this, elem, data = {}, // Allows the plugin to call a string callback method. method_base = jquery_data_key ? $.fn : $, // Any additional arguments will be passed to the callback. args = arguments, slice_args = 4, id = args[1], delay = args[2], callback = args[3]; if ( typeof id !== 'string' ) { slice_args--; id = jquery_data_key = 0; delay = args[1]; callback = args[2]; } // If id is passed, store a data reference either as .data on the first // element in a jQuery collection, or in the internal cache. if ( jquery_data_key ) { // Note: key is 'doTimeout' + id // Get id-object from the first element's data, otherwise initialize it to {}. elem = that.eq(0); elem.data( jquery_data_key, data = elem.data( jquery_data_key ) || {} ); } else if ( id ) { // Get id-object from the cache, otherwise initialize it to {}. data = cache[ id ] || ( cache[ id ] = {} ); } // Clear any existing timeout for this id. data.id && clearTimeout( data.id ); delete data.id; // Clean up when necessary. function cleanup() { if ( jquery_data_key ) { elem.removeData( jquery_data_key ); } else if ( id ) { delete cache[ id ]; } }; // Yes, there actually is a setTimeout call in here! function actually_setTimeout() { data.id = setTimeout( function(){ data.fn(); }, delay ); }; if ( callback ) { // A callback (and delay) were specified. Store the callback reference for // possible later use, and then setTimeout. data.fn = function( no_polling_loop ) { // If the callback value is a string, it is assumed to be the name of a // method on $ or $.fn depending on where doTimeout was executed. if ( typeof callback === 'string' ) { callback = method_base[ callback ]; } callback.apply( that, aps.call( args, slice_args ) ) === true && !no_polling_loop // Since the callback returned true, and we're not specifically // canceling a polling loop, do it again! ? actually_setTimeout() // Otherwise, clean up and quit. : cleanup(); }; // Set that timeout! actually_setTimeout(); } else if ( data.fn ) { // No callback passed. If force_mode (delay) is true, execute the data.fn // callback immediately, continuing any callback return-true polling loop. // If force_mode is false, execute the data.fn callback immediately but do // NOT continue a callback return-true polling loop. If force_mode is // undefined, simply clean up. Since data.fn was still defined, whatever // was supposed to happen hadn't yet, so return true. delay === undefined ? cleanup() : data.fn( delay === false ); return true; } else { // Since no callback was passed, and data.fn isn't defined, it looks like // whatever was supposed to happen already did. Clean up and quit! cleanup(); } }; })(jQuery); //CSS3 Animate-it $('.animatedParent').appear(); $('.animatedClick').click(function(){ var target = $(this).attr('data-target'); if($(this).attr('data-sequence') != undefined){ var firstId = $("."+target+":first").attr('data-id'); var lastId = $("."+target+":last").attr('data-id'); var number = firstId; //Add or remove the class if($("."+target+"[data-id="+ number +"]").hasClass('go')){ $("."+target+"[data-id="+ number +"]").addClass('goAway'); $("."+target+"[data-id="+ number +"]").removeClass('go'); }else{ $("."+target+"[data-id="+ number +"]").addClass('go'); $("."+target+"[data-id="+ number +"]").removeClass('goAway'); } number ++; delay = Number($(this).attr('data-sequence')); $.doTimeout(delay, function(){ console.log(lastId); //Add or remove the class if($("."+target+"[data-id="+ number +"]").hasClass('go')){ $("."+target+"[data-id="+ number +"]").addClass('goAway'); $("."+target+"[data-id="+ number +"]").removeClass('go'); }else{ $("."+target+"[data-id="+ number +"]").addClass('go'); $("."+target+"[data-id="+ number +"]").removeClass('goAway'); } //increment ++number; //continute looping till reached last ID if(number <= lastId){return true;} }); }else{ if($('.'+target).hasClass('go')){ $('.'+target).addClass('goAway'); $('.'+target).removeClass('go'); }else{ $('.'+target).addClass('go'); $('.'+target).removeClass('goAway'); } } }); $(document.body).on('appear', '.animatedParent', function(e, $affected){ var ele = $(this).find('.animated'); var parent = $(this); if(parent.attr('data-sequence') != undefined){ var firstId = $(this).find('.animated:first').attr('data-id'); var number = firstId; var lastId = $(this).find('.animated:last').attr('data-id'); $(parent).find(".animated[data-id="+ number +"]").addClass('go'); number ++; delay = Number(parent.attr('data-sequence')); $.doTimeout(delay, function(){ $(parent).find(".animated[data-id="+ number +"]").addClass('go'); ++number; if(number <= lastId){return true;} }); }else{ ele.addClass('go'); } }); $(document.body).on('disappear', '.animatedParent', function(e, $affected) { if(!$(this).hasClass('animateOnce')){ $(this).find('.animated').removeClass('go'); } }); $(window).on('load',function(){ $.force_appear(); });