Skip to content
This repository

iPad screen scrolling issue #51

Closed
wants to merge 1 commit into from

1 participant

Leon de Almeida
Leon de Almeida

Removing the preloader element after we're done using it fixes the
issue where the animations cease after interacting with the screen
(specially scrolling). Fixes #49.

Leon de Almeida leondealmeida iPad Sequence issue
Removing the preloader element after we're done using it fixes the
issue where the animations cease after interacting with the screen
(specially scrolling). Fixes #49.
039c73e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 12, 2012
Leon de Almeida leondealmeida iPad Sequence issue
Removing the preloader element after we're done using it fixes the
issue where the animations cease after interacting with the screen
(specially scrolling). Fixes #49.
039c73e
This page is out of date. Refresh to see the latest.
2  scripts/sequence.jquery-min.js
@@ -10,4 +10,4 @@ http://www.opensource.org/licenses/mit-license.php | http://www.gnu.org/licenses
10 10
11 11 Sequence.js and its dependencies are (c) Ian Lunn Design 2012 unless otherwise stated.
12 12 Aside from these comments, you may modify and distribute this file as you please. Have fun!
13   -*/(function(a){function b(b,c,d,e){function j(){f.settings.nextButton=f.init.uiElements(f.settings.prependNextButton,c.nextButton,d.nextButton,f.settings.nextButtonSrc,f.settings.nextButtonAlt);f.settings.prevButton=f.init.uiElements(f.settings.prependPrevButton,c.prevButton,d.prevButton,f.settings.prevButtonSrc,f.settings.prevButtonAlt);c.nextButton!=0&&f.settings.showNextButtonOnInit&&f.settings.nextButton.show();c.prevButton!=0&&f.settings.showPrevButtonOnInit&&f.settings.prevButton.show();if(f.settings.pauseIcon!=0){f.settings.pauseIcon=f.init.uiElements(f.settings.prependPauseIcon,c.pauseIcon,".pause-icon",f.settings.pauseIconSrc);f.settings.pauseIcon!=undefined&&f.settings.pauseIcon.hide()}f.hasTouch&&(f.settings.calculatedSwipeThreshold=f.container.width()*(f.settings.swipeThreshold/100));f.currentFrame=f.sequence.children("li:nth-child("+f.settings.startingFrameID+")").addClass("current");f.currentFrameChildren=f.currentFrame.children();f.currentFrameID=f.settings.startingFrameID;f.nextFrameID=f.currentFrameID;f.sequence.children("li").children().removeClass("animate-in");f.direction;f.sequence.css({width:"100%",height:"100%"});if(f.transitionsSupported){whenFirstAnimateInEnds=function(){animationComplete=function(){f.settings.afterNextFrameAnimatesIn();f.active=!1;if(f.settings.autoPlay){autoPlaySequence=function(){f.autoPlaySequence()};clearTimeout(f.sequenceTimer);f.sequenceTimer=setTimeout(autoPlaySequence,f.settings.autoPlayDelay,f)}};f.waitForAnimationsToComplete(f.currentFrameChildren,animationComplete)};if(!f.settings.animateStartingFrameIn){f.modifyElements(f.currentFrameChildren,"0s");f.currentFrameChildren.addClass("animate-in");setTimeout(function(){f.modifyElements(f.currentFrameChildren,"")},100);if(f.settings.autoPlay){autoPlaySequence=function(){f.autoPlaySequence()};clearTimeout(f.sequenceTimer);f.sequenceTimer=setTimeout(autoPlaySequence,f.settings.autoPlayDelay,f)}}else if(f.settings.reverseAnimationsWhenNavigatingBackwards&&f.settings.autoPlayDirection-1&&f.settings.animateStartingFrameIn){f.active=!0;f.modifyElements(f.currentFrameChildren,"0s");f.currentFrameChildren.addClass("animate-out");f.settings.beforeNextFrameAnimatesIn();setTimeout(function(){f.modifyElements(f.currentFrameChildren,"");f.currentFrameChildren.removeClass("animate-out");f.currentFrameChildren.addClass("animate-in")},100);whenFirstAnimateInEnds()}else{f.active=!0;f.settings.beforeCurrentFrameAnimatesIn();setTimeout(function(){f.modifyElements(f.currentFrameChildren,"");f.currentFrameChildren.addClass("animate-in")},100);whenFirstAnimateInEnds()}}else{f.sequence.children("li").children().css("opacity","0").addClass("animate-in").animate({opacity:"1"},500);f.currentFrame.css("z-index",f.numberOfFrames);f.sequence.children(":not(li:nth-child("+f.settings.startingFrameID+"))").css({display:"none",opacity:0});if(f.settings.autoPlay){autoPlaySequence=function(){f.autoPlaySequence()};clearTimeout(f.sequenceTimer);f.sequenceTimer=setTimeout(autoPlaySequence,f.settings.autoPlayDelay,f)}}f.settings.nextButton!=undefined&&f.settings.nextButton.click(function(){f.next()});f.settings.prevButton!=undefined&&f.settings.prevButton.click(function(){f.prev()});f.settings.keysNavigate==1&&a(document).keydown(function(a){a.keyCode==39&&f.next();a.keyCode==37&&f.prev()});if(f.settings.pauseOnHover&&!f.settings.pauseOnElementsOutsideContainer&&f.settings.autoPlay){function b(b){containerLeft=f.container.position().left;containerRight=f.container.position().left+f.container.width();containerTop=f.container.position().top;containerBottom=f.container.position().top+f.container.height();pageX=b.pageX;pageY=b.pageY;if(pageX>=containerLeft&&pageX<=containerRight&&pageY>=containerTop&&pageY<=containerBottom){f.settings.autoPlay=!1;clearTimeout(f.sequenceTimer);a(f.settings.pauseIcon).show();f.sequence.unbind("mousemove")}}f.hoverEvent=f.sequence.mousemove(function(a){b(a)});f.sequence.mouseleave(function(c){f.settings.autoPlay=!0;autoPlaySequence=function(){f.autoPlaySequence()};clearTimeout(f.sequenceTimer);f.sequenceTimer=setTimeout(autoPlaySequence,f.settings.autoPlayDelay,f);a(f.settings.pauseIcon).hide();f.sequence.data("events").mousemove==undefined&&f.sequence.mousemove(function(a){b(a)})})}else f.settings.pauseOnHover&&f.settings.autoPlay&&(f.hoverEvent=f.sequence.hover(function(b){f.settings.autoPlay=!1;clearTimeout(f.sequenceTimer);a(f.settings.pauseIcon).show()},function(){f.settings.autoPlay=!0;autoPlaySequence=function(){f.autoPlaySequence()};clearTimeout(f.sequenceTimer);f.sequenceTimer=setTimeout(autoPlaySequence,f.settings.autoPlayDelay,f);a(f.settings.pauseIcon).hide()}));if(f.settings.touchEnabled&&f.hasTouch){var e,g={touchstart:-1,touchmove:-1,swipeDirection:""};f.sequence.bind("touchstart touchmove touchend",function(a){a.preventDefault();switch(a.originalEvent.type){case"touchstart":case"touchmove":g[a.originalEvent.type]=a.originalEvent.touches[0].pageX;break;case"touchend":g.touchstart>-1&&g.touchmove>f.settings.calculatedSwipeThreshold&&(g.touchstart<g.touchmove?f.next():f.prev());default:}})}a(window).resize(function(){f.settings.calculatedSwipeThreshold=f.container.width()*(f.settings.swipeThreshold/100)})}var f=this;f.container=a(b),f.sequence=f.container.children("ul");try{Modernizr.prefixed;if(Modernizr.prefixed==undefined)throw"undefined"}catch(g){e.modernizr()}var h={WebkitTransition:"-webkit-",MozTransition:"-moz-",OTransition:"-o-",msTransition:"-ms-",transition:""},i={WebkitTransition:"webkitTransitionEnd webkitAnimationEnd",MozTransition:"transitionend animationend",OTransition:"oTransitionEnd oAnimationEnd",msTransition:"MSTransitionEnd MSAnimationEnd",transition:"transitionend animationend"};f.prefix=h[Modernizr.prefixed("transition")],f.transitionEnd=i[Modernizr.prefixed("transition")],f.transitionProperties={},f.numberOfFrames=f.sequence.children("li").length,f.transitionsSupported=f.prefix!=undefined?!0:!1,f.hasTouch="ontouchstart"in window?!0:!1,f.sequenceTimer,f.paused=!1,f.hoverEvent,f.defaultPreloader,f.init={preloader:function(b){prependTo=f.settings.prependPreloader==1?f.container:f.settings.prependPreloader;switch(b){case!0:case undefined:e.defaultPreloader(prependTo,f.transitionsSupported,f.prefix);(!f.transitionsSupported||f.prefix=="-o-")&&f.preloaderFallback();return a("#sequence-preloader");case!1:break;default:this.CSSSelectorToHTML(b);return a(b)}},uiElements:function(b,c,d,e,g){prependElement=b==1?f.container:b;switch(c){case!0:case undefined:a(prependElement).prepend("<img "+this.CSSSelectorToHTML(d)+'src="'+e+'" alt="'+g+'" />');return a(d);case!1:break;default:a(prependElement).prepend("<img "+this.CSSSelectorToHTML(c)+'src="'+e+'" alt="'+g+'" />');return a(c)}},CSSSelectorToHTML:function(a){switch(a.charAt(0)){case".":return'class="'+a.split(".")[1]+'"';case"#":return'id="'+a.split("#")[1]+'"';default:return a}}},f.settings=a.extend({},d,c),f.settings.preloader=f.init.preloader(f.settings.preloader);if(f.settings.animateStartingFrameIn){f.modifyElements(f.sequence.children("li").children(),"0s");f.sequence.children("li").children().removeClass("animate-in")}c.preloader!=0?a(window).bind("load",function(){f.settings.afterPreload();if(f.settings.hidePreloaderUsingCSS&&f.transitionsSupported&&f.prefix!="-o-"){prependPreloadingCompleteTo=f.settings.prependPreloadingComplete==1?f.settings.preloader:a(f.settings.prependPreloadingComplete);prependPreloadingCompleteTo.addClass("preloading-complete");setTimeout(j,f.settings.hidePreloaderDelay)}else f.settings.preloader.fadeOut(f.settings.hidePreloaderDelay,function(){clearInterval(f.defaultPreloader);j()});a(window).unbind("load")}):j()}b.prototype={preloaderFallback:function(){function b(){i=i==1?0:1;a("#sequence-preloader img:nth-child(1)").animate({opacity:i},100);a("#sequence-preloader img:nth-child(2)").animate({opacity:i},350);a("#sequence-preloader img:nth-child(3)").animate({opacity:i},600)}i=0;b();self.defaultPreloader=setInterval(function(){b()},600)},autoPlaySequence:function(a){var b=this;b.settings.autoPlayDirection==1?b.next():b.prev()},modifyElements:function(a,b){var c=this;a.css(c.prefixCSS(c.prefix,{"transition-duration":b,"transition-delay":b}))},prefixCSS:function(a,b){css={};for(property in b)css[a+property]=b[property];return css},getStyleBySelector:function(a){css={};var b=document.styleSheets,c,d,e;for(d=b.length-1;d>=0;d--){error=!1;try{c=b[d].cssRules}catch(f){error=!0}if(!error)for(e=0;e<c.length;e++)if(c[e].type==CSSRule.STYLE_RULE&&c[e].selectorText==a){css["-o-transition-duration"]=c[e].style.OTransitionDuration;css["-o-transition-delay"]=c[e].style.OTransitionDelay;return css}}return null},startAutoPlay:function(b,c){var d=this;b=b==undefined?0:b;d.settings.autoPlayDelay=c==undefined?d.settings.autoPlayDelay:c;d.settings.autoPlay=!0;autoPlaySequence=function(){d.autoPlaySequence()};clearTimeout(d.sequenceTimer);d.sequenceTimer=setTimeout(autoPlaySequence,d.settings.autoPlayDelay,d);d.settings.pauseOnHover&&(d.hoverEvent=d.sequence.hover(function(){d.settings.autoPlay=!1;clearTimeout(d.sequenceTimer);a(d.settings.pauseIcon).show()},function(){d.settings.autoPlay=!0;autoPlaySequence=function(){d.autoPlaySequence()};clearTimeout(d.sequenceTimer);d.sequenceTimer=setTimeout(autoPlaySequence,d.settings.autoPlayDelay,d);a(d.settings.pauseIcon).hide()}))},stopAutoPlay:function(){var a=this;a.settings.autoPlay=!1;clearTimeout(a.sequenceTimer);a.hoverEvent!=undefined&&a.hoverEvent.unbind()},next:function(){var a=this;if(!a.active)if(a.settings.cycle||!a.settings.cycle&&a.currentFrame.index()+1!=a.numberOfFrames){if(a.paused){a.paused=!1;a.startAutoPlay()}a.nextFrameID=a.currentFrame.index()+1!=a.numberOfFrames?a.currentFrameID+1:1;a.goTo(a.nextFrameID,1)}else if(a.settings.autoPlayDirection==1){a.paused=!0;a.stopAutoPlay()}},prev:function(){var a=this;if(!a.active)if(a.settings.cycle||!a.settings.cycle&&a.currentFrame.index()+1!=1){if(a.paused){a.paused=!1;a.startAutoPlay()}a.nextFrameID=a.currentFrame.index()+1==1?a.numberOfFrames:a.currentFrameID-1;a.goTo(a.nextFrameID,-1)}else if(a.settings.autoPlayDirection==-1){a.paused=!0;a.stopAutoPlay()}},goTo:function(a,b){var c=this;a==c.numberOfFrames?c.settings.beforeLastFrameAnimatesIn():a==1&&c.settings.beforeFirstFrameAnimatesIn();if(a==c.currentFrame.index()+1)return!1;if(!c.active){c.active=!0;c.currentFrame=c.sequence.children(".current");nextFrame=c.sequence.children("li:nth-child("+a+")");b==undefined?c.direction=a>c.currentFrameID?1:-1:c.direction=b;frameChildren=c.currentFrame.children();nextFrameChildren=nextFrame.children();if(c.transitionsSupported){c.settings.beforeCurrentFrameAnimatesOut();c.animateOut(c.direction);animateIn=function(){c.animateIn(c.direction);c.currentFrameID=a};switch(c.settings.delayDuringOutInTransitions){case!0:c.waitForAnimationsToComplete(frameChildren,animateIn);break;case!1:animateIn();break;default:setTimeout(animateIn,c.settings.delayDuringOutInTransitions)}}else{c.sequence.children("li").css({position:"relative"});c.currentFrame.animate({opacity:0},c.settings.fallbackTheme.speed,function(){c.currentFrame.css({display:"none","z-index":"1"});c.currentFrame.removeClass("current");c.settings.beforeNextFrameAnimatesIn();nextFrame.addClass("current").css({display:"block","z-index":c.numberOfFrames}).animate({opacity:1},500);c.currentFrame=nextFrame;c.currentFrameID=c.currentFrame.index()+1;c.active=!1;if(c.settings.autoPlay){autoPlaySequence=function(){c.autoPlaySequence()};clearTimeout(c.sequenceTimer);c.sequenceTimer=setTimeout(autoPlaySequence,c.settings.autoPlayDelay,c)}})}}},animateOut:function(b){var c=this;c.settings.beforeCurrentFrameAnimatesIn();if(!c.settings.reverseAnimationsWhenNavigatingBackwards||b==1){c.modifyElements(nextFrameChildren,"0s");nextFrameChildren.removeClass("animate-out");c.modifyElements(frameChildren,"");c.settings.disableAnimateOut||frameChildren.addClass("animate-out").removeClass("animate-in")}if(c.settings.reverseAnimationsWhenNavigatingBackwards&&b==-1){c.modifyElements(nextFrameChildren,"0s");c.settings.disableAnimateOut?c.active=!1:nextFrameChildren.addClass("animate-out");c.modifyElements(frameChildren,"");frameChildren.each(function(){if(c.prefix=="-o-"){selector="."+a(this).attr("class").replace(" ",".");previousFrameTransitionProperties=c.getStyleBySelector(selector);c.transitionProperties["transition-duration"]=previousFrameTransitionProperties["-o-transition-duration"];c.transitionProperties["transition-delay"]=previousFrameTransitionProperties["-o-transition-delay"];c.transitionProperties["transition-delay"]=c.transitionProperties["transition-delay"]==""?"0s":c.transitionProperties["transition-delay"]}else{c.transitionProperties["transition-duration"]=a(this).css(c.prefix+"transition-duration");c.transitionProperties["transition-delay"]=a(this).css(c.prefix+"transition-delay")}a(this).css(c.prefixCSS(c.prefix,c.transitionProperties)).removeClass("animate-in")})}},waitForAnimationsToComplete:function(b,c){var d=this;elementsAnimated={};b.each(function(){elementsAnimated[a(this).attr("class")]=!1});d.currentFrame.bind(d.transitionEnd,function(a){elementsAnimated[a.target.className]=!0;total=0;for(element in elementsAnimated)elementsAnimated[element]==1&&total++;total==b.length&&c()})},animateIn:function(a){var b=this;b.currentFrame.removeClass("current");b.currentFrame.unbind(b.transitionEnd);nextFrame.addClass("current");b.currentFrame=nextFrame;a==1?b.currentFrameID=b.currentFrameID!=b.numberOfFrames?b.currentFrameID+1:1:b.currentFrameID=b.currentFrameID!=1?b.currentFrameID-1:b.numberOfFrames;nextFrameChildren=nextFrame.children();frameChildren=b.currentFrame.children();b.settings.beforeNextFrameAnimatesIn();if(!b.settings.reverseAnimationsWhenNavigatingBackwards||a==1){b.modifyElements(nextFrameChildren,"0s");nextFrameChildren.removeClass("animate-out");setTimeout(function(){frameChildren.removeClass("animate-out");b.modifyElements(frameChildren,"");frameChildren.addClass("animate-in");whenAnimationEnds()},50)}b.settings.reverseAnimationsWhenNavigatingBackwards&&a==-1&&setTimeout(function(){b.modifyElements(frameChildren,"");frameChildren.addClass("animate-in").removeClass("animate-out");whenAnimationEnds()},50);whenAnimationEnds=function(){unbind=function(){b.settings.afterNextFrameAnimatesIn();b.currentFrameID==b.numberOfFrames?b.settings.afterLastFrameAnimatesIn():b.currentFrameID==1&&b.settings.afterFirstFrameAnimatesIn();b.currentFrame.unbind(b.transitionEnd);b.active=!1;if(b.settings.autoPlay){autoPlaySequence=function(){b.autoPlaySequence()};clearTimeout(b.sequenceTimer);b.sequenceTimer=setTimeout(autoPlaySequence,b.settings.autoPlayDelay,b)}};b.waitForAnimationsToComplete(nextFrameChildren,unbind)}}};a.fn.sequence=function(e){return this.each(function(){var f=new b(a(this),e,d,c);a(this).data("sequence",f)})};var c={modernizr:function(){window.Modernizr=function(a,b,c){function d(a){p.cssText=a}function e(a,b){return d(prefixes.join(a+";")+(b||""))}function f(a,b){return typeof a===b}function g(a,b){return!!~(""+a).indexOf(b)}function h(a,b){for(var d in a)if(p[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function i(a,b,d){for(var e in a){var g=b[a[e]];if(g!==c)return d===!1?a[e]:f(g,"function")?g.bind(d||b):g}return!1}function j(a,b,c){var d=a.charAt(0).toUpperCase()+a.substr(1),e=(a+" "+t.join(d+" ")+d).split(" ");return f(b,"string")||f(b,"undefined")?h(e,b):(e=(a+" "+u.join(d+" ")+d).split(" "),i(e,b,c))}var k="2.5.3",l={},m=b.documentElement,n="modernizr",o=b.createElement(n),p=o.style,q,r={}.toString,s="Webkit Moz O ms",t=s.split(" "),u=s.toLowerCase().split(" "),v={},w={},x={},y=[],z=y.slice,A,B={}.hasOwnProperty,C;!f(B,"undefined")&&!f(B.call,"undefined")?C=function(a,b){return B.call(a,b)}:C=function(a,b){return b in a&&f(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(a){var b=self;if(typeof b!="function")throw new TypeError;var c=z.call(arguments,1),d=function(){if(self instanceof d){var e=function(){};e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(z.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(z.call(arguments)))};return d});for(var D in v)C(v,D)&&(A=D.toLowerCase(),l[A]=v[D](),y.push((l[A]?"":"no-")+A));return d(""),o=q=null,l._version=k,l._domPrefixes=u,l._cssomPrefixes=t,l.testProp=function(a){return h([a])},l.testAllProps=j,l.prefixed=function(a,b,c){return b?j(a,b,c):j(a,"pfx")},l}(self,self.document)},defaultPreloader:function(b,c,d){opacity=c?0:1;a("head").append("<style>#sequence-preloader{height: 100%;position: absolute;width: 100%;z-index: 999999;}@"+d+"keyframes preload{0%{opacity: 0;}50%{opacity: 1;}100%{opacity: 0;}}#sequence-preloader img{background: #ff9933;border-radius: 6px;display: inline-block;height: 12px;opacity: "+opacity+";position: relative;top: -50%;width: 12px;"+d+"animation: preload 1s infinite; animation: preload 1s infinite;}.preloading{height: 12px;margin: 0 auto;top: 50%;position: relative;width: 48px;}#sequence-preloader img:nth-child(2){"+d+"animation-delay: .15s; animation-delay: .15s;}#sequence-preloader img:nth-child(3){"+d+"animation-delay: .3s; animation-delay: .3s;}.preloading-complete{opacity: 0;visibility: hidden;"+d+"transition-duration: 1s; transition-duration: 1s;}</style>");a(b).prepend('<div id="sequence-preloader"><div class="preloading"><img src="images/sequence-preloader.png" alt="Sequence is loading, please wait..." /> <img src="images/sequence-preloader.png" alt="Sequence is loading, please wait..." /> <img src="images/sequence-preloader.png" alt="Sequence is loading, please wait..." /></div></div>')}},d={nextButton:".next",prependNextButton:!0,nextButtonSrc:"images/bt-next.png",nextButtonAlt:"&#gt;",showNextButtonOnInit:!0,prevButton:".prev",prependPrevButton:!0,prevButtonSrc:"images/bt-prev.png",prevButtonAlt:"&#lt;",showPrevButtonOnInit:!0,preloader:!0,prependPreloader:!0,prependPreloadingComplete:!0,hidePreloaderUsingCSS:!0,hidePreloaderDelay:0,startingFrameID:1,autoPlay:!0,autoPlayDirection:1,animatestartingFrameIn:!1,autoPlayDelay:5e3,pauseOnHover:!0,pauseIcon:!1,prependPauseIcon:!0,pauseIconSrc:"images/pause-icon.png",pauseAlt:"Pause",keysNavigate:!0,delayDuringOutInTransitions:1e3,touchEnabled:!0,swipeThreshold:15,cycle:!0,disableAnimateOut:!1,reverseAnimationsWhenNavigatingBackwards:!0,pauseOnElementsOutsideContainer:!1,fallbackTheme:{speed:500},beforeCurrentFrameAnimatesOut:function(){},beforeNextFrameAnimatesIn:function(){},afterNextFrameAnimatesIn:function(){},beforeCurrentFrameAnimatesIn:function(){},beforeFirstFrameAnimatesIn:function(){},afterFirstFrameAnimatesIn:function(){},beforeLastFrameAnimatesIn:function(){},afterLastFrameAnimatesIn:function(){},afterPreload:function(){}}})(jQuery);
  13 +*/(function(a){function b(b,c,d,e){function j(){a("#sequence-preloader").remove(),f.settings.nextButton=f.init.uiElements(f.settings.prependNextButton,c.nextButton,d.nextButton,f.settings.nextButtonSrc,f.settings.nextButtonAlt),f.settings.prevButton=f.init.uiElements(f.settings.prependPrevButton,c.prevButton,d.prevButton,f.settings.prevButtonSrc,f.settings.prevButtonAlt),c.nextButton!=0&&f.settings.showNextButtonOnInit&&f.settings.nextButton.show(),c.prevButton!=0&&f.settings.showPrevButtonOnInit&&f.settings.prevButton.show(),f.settings.pauseIcon!=0&&(f.settings.pauseIcon=f.init.uiElements(f.settings.prependPauseIcon,c.pauseIcon,".pause-icon",f.settings.pauseIconSrc),f.settings.pauseIcon!=undefined&&f.settings.pauseIcon.hide()),f.hasTouch&&(f.settings.calculatedSwipeThreshold=f.container.width()*(f.settings.swipeThreshold/100)),f.currentFrame=f.sequence.children("li:nth-child("+f.settings.startingFrameID+")").addClass("current"),f.currentFrameChildren=f.currentFrame.children(),f.currentFrameID=f.settings.startingFrameID,f.nextFrameID=f.currentFrameID,f.sequence.children("li").children().removeClass("animate-in"),f.direction,f.sequence.css({width:"100%",height:"100%"}),f.transitionsSupported?(whenFirstAnimateInEnds=function(){animationComplete=function(){f.settings.afterNextFrameAnimatesIn(),f.active=!1,f.settings.autoPlay&&(autoPlaySequence=function(){f.autoPlaySequence()},clearTimeout(f.sequenceTimer),f.sequenceTimer=setTimeout(autoPlaySequence,f.settings.autoPlayDelay,f))},f.waitForAnimationsToComplete(f.currentFrameChildren,animationComplete)},f.settings.animateStartingFrameIn?f.settings.reverseAnimationsWhenNavigatingBackwards&&f.settings.autoPlayDirection-1&&f.settings.animateStartingFrameIn?(f.active=!0,f.modifyElements(f.currentFrameChildren,"0s"),f.currentFrameChildren.addClass("animate-out"),f.settings.beforeNextFrameAnimatesIn(),setTimeout(function(){f.modifyElements(f.currentFrameChildren,""),f.currentFrameChildren.removeClass("animate-out"),f.currentFrameChildren.addClass("animate-in")},100),whenFirstAnimateInEnds()):(f.active=!0,f.settings.beforeCurrentFrameAnimatesIn(),setTimeout(function(){f.modifyElements(f.currentFrameChildren,""),f.currentFrameChildren.addClass("animate-in")},100),whenFirstAnimateInEnds()):(f.modifyElements(f.currentFrameChildren,"0s"),f.currentFrameChildren.addClass("animate-in"),setTimeout(function(){f.modifyElements(f.currentFrameChildren,"")},100),f.settings.autoPlay&&(autoPlaySequence=function(){f.autoPlaySequence()},clearTimeout(f.sequenceTimer),f.sequenceTimer=setTimeout(autoPlaySequence,f.settings.autoPlayDelay,f)))):(f.sequence.children("li").children().css("opacity","0").addClass("animate-in").animate({opacity:"1"},500),f.currentFrame.css("z-index",f.numberOfFrames),f.sequence.children(":not(li:nth-child("+f.settings.startingFrameID+"))").css({display:"none",opacity:0}),f.settings.autoPlay&&(autoPlaySequence=function(){f.autoPlaySequence()},clearTimeout(f.sequenceTimer),f.sequenceTimer=setTimeout(autoPlaySequence,f.settings.autoPlayDelay,f))),f.settings.nextButton!=undefined&&f.settings.nextButton.click(function(){f.next()}),f.settings.prevButton!=undefined&&f.settings.prevButton.click(function(){f.prev()}),f.settings.keysNavigate==1&&a(document).keydown(function(a){a.keyCode==39&&f.next(),a.keyCode==37&&f.prev()});if(f.settings.pauseOnHover&&!f.settings.pauseOnElementsOutsideContainer&&f.settings.autoPlay){function b(b){containerLeft=f.container.position().left,containerRight=f.container.position().left+f.container.width(),containerTop=f.container.position().top,containerBottom=f.container.position().top+f.container.height(),pageX=b.pageX,pageY=b.pageY,pageX>=containerLeft&&pageX<=containerRight&&pageY>=containerTop&&pageY<=containerBottom&&(f.settings.autoPlay=!1,clearTimeout(f.sequenceTimer),a(f.settings.pauseIcon).show(),f.sequence.unbind("mousemove"))}f.hoverEvent=f.sequence.mousemove(function(a){b(a)}),f.sequence.mouseleave(function(c){f.settings.autoPlay=!0,autoPlaySequence=function(){f.autoPlaySequence()},clearTimeout(f.sequenceTimer),f.sequenceTimer=setTimeout(autoPlaySequence,f.settings.autoPlayDelay,f),a(f.settings.pauseIcon).hide(),f.sequence.data("events").mousemove==undefined&&f.sequence.mousemove(function(a){b(a)})})}else f.settings.pauseOnHover&&f.settings.autoPlay&&(f.hoverEvent=f.sequence.hover(function(b){f.settings.autoPlay=!1,clearTimeout(f.sequenceTimer),a(f.settings.pauseIcon).show()},function(){f.settings.autoPlay=!0,autoPlaySequence=function(){f.autoPlaySequence()},clearTimeout(f.sequenceTimer),f.sequenceTimer=setTimeout(autoPlaySequence,f.settings.autoPlayDelay,f),a(f.settings.pauseIcon).hide()}));if(f.settings.touchEnabled&&f.hasTouch){var e,g={touchstart:-1,touchmove:-1,swipeDirection:""};f.sequence.bind("touchstart touchmove touchend",function(a){a.preventDefault();switch(a.originalEvent.type){case"touchstart":case"touchmove":g[a.originalEvent.type]=a.originalEvent.touches[0].pageX;break;case"touchend":g.touchstart>-1&&g.touchmove>f.settings.calculatedSwipeThreshold&&(g.touchstart<g.touchmove?f.next():f.prev());default:}})}a(window).resize(function(){f.settings.calculatedSwipeThreshold=f.container.width()*(f.settings.swipeThreshold/100)})}var f=this;f.container=a(b),f.sequence=f.container.children("ul");try{Modernizr.prefixed;if(Modernizr.prefixed==undefined)throw"undefined"}catch(g){e.modernizr()}var h={WebkitTransition:"-webkit-",MozTransition:"-moz-",OTransition:"-o-",msTransition:"-ms-",transition:""},i={WebkitTransition:"webkitTransitionEnd webkitAnimationEnd",MozTransition:"transitionend animationend",OTransition:"oTransitionEnd oAnimationEnd",msTransition:"MSTransitionEnd MSAnimationEnd",transition:"transitionend animationend"};f.prefix=h[Modernizr.prefixed("transition")],f.transitionEnd=i[Modernizr.prefixed("transition")],f.transitionProperties={},f.numberOfFrames=f.sequence.children("li").length,f.transitionsSupported=f.prefix!=undefined?!0:!1,f.hasTouch="ontouchstart"in window?!0:!1,f.sequenceTimer,f.paused=!1,f.hoverEvent,f.defaultPreloader,f.init={preloader:function(b){prependTo=f.settings.prependPreloader==1?f.container:f.settings.prependPreloader;switch(b){case!0:case undefined:return e.defaultPreloader(prependTo,f.transitionsSupported,f.prefix),(!f.transitionsSupported||f.prefix=="-o-")&&f.preloaderFallback(),a("#sequence-preloader");case!1:break;default:return this.CSSSelectorToHTML(b),a(b)}},uiElements:function(b,c,d,e,g){prependElement=b==1?f.container:b;switch(c){case!0:case undefined:return a(prependElement).prepend("<img "+this.CSSSelectorToHTML(d)+'src="'+e+'" alt="'+g+'" />'),a(d);case!1:break;default:return a(prependElement).prepend("<img "+this.CSSSelectorToHTML(c)+'src="'+e+'" alt="'+g+'" />'),a(c)}},CSSSelectorToHTML:function(a){switch(a.charAt(0)){case".":return'class="'+a.split(".")[1]+'"';case"#":return'id="'+a.split("#")[1]+'"';default:return a}}},f.settings=a.extend({},d,c),f.settings.preloader=f.init.preloader(f.settings.preloader),f.settings.animateStartingFrameIn&&(f.modifyElements(f.sequence.children("li").children(),"0s"),f.sequence.children("li").children().removeClass("animate-in")),f.settings.preloader?a(window).bind("load",function(){f.settings.afterPreload(),f.settings.hidePreloaderUsingCSS&&f.transitionsSupported&&f.prefix!="-o-"?(prependPreloadingCompleteTo=f.settings.prependPreloadingComplete==1?f.settings.preloader:a(f.settings.prependPreloadingComplete),prependPreloadingCompleteTo.addClass("preloading-complete"),setTimeout(j,f.settings.hidePreloaderDelay)):f.settings.preloader.fadeOut(f.settings.hidePreloaderDelay,function(){clearInterval(f.defaultPreloader),j()}),a(window).unbind("load")}):j()}b.prototype={preloaderFallback:function(){function b(){i=i==1?0:1,a("#sequence-preloader img:nth-child(1)").animate({opacity:i},100),a("#sequence-preloader img:nth-child(2)").animate({opacity:i},350),a("#sequence-preloader img:nth-child(3)").animate({opacity:i},600)}i=0,b(),self.defaultPreloader=setInterval(function(){b()},600)},autoPlaySequence:function(a){var b=this;b.settings.autoPlayDirection==1?b.next():b.prev()},modifyElements:function(a,b){var c=this;a.css(c.prefixCSS(c.prefix,{"transition-duration":b,"transition-delay":b}))},prefixCSS:function(a,b){css={};for(property in b)css[a+property]=b[property];return css},getStyleBySelector:function(a){css={};var b=document.styleSheets,c,d,e;for(d=b.length-1;d>=0;d--){error=!1;try{c=b[d].cssRules}catch(f){error=!0}if(!error)for(e=0;e<c.length;e++)if(c[e].type==CSSRule.STYLE_RULE&&c[e].selectorText==a)return css["-o-transition-duration"]=c[e].style.OTransitionDuration,css["-o-transition-delay"]=c[e].style.OTransitionDelay,css}return null},startAutoPlay:function(b,c){var d=this;b=b==undefined?0:b,d.settings.autoPlayDelay=c==undefined?d.settings.autoPlayDelay:c,d.settings.autoPlay=!0,autoPlaySequence=function(){d.autoPlaySequence()},clearTimeout(d.sequenceTimer),d.sequenceTimer=setTimeout(autoPlaySequence,d.settings.autoPlayDelay,d),d.settings.pauseOnHover&&(d.hoverEvent=d.sequence.hover(function(){d.settings.autoPlay=!1,clearTimeout(d.sequenceTimer),a(d.settings.pauseIcon).show()},function(){d.settings.autoPlay=!0,autoPlaySequence=function(){d.autoPlaySequence()},clearTimeout(d.sequenceTimer),d.sequenceTimer=setTimeout(autoPlaySequence,d.settings.autoPlayDelay,d),a(d.settings.pauseIcon).hide()}))},stopAutoPlay:function(){var a=this;a.settings.autoPlay=!1,clearTimeout(a.sequenceTimer),a.hoverEvent!=undefined&&a.hoverEvent.unbind()},next:function(){var a=this;a.active||(a.settings.cycle||!a.settings.cycle&&a.currentFrame.index()+1!=a.numberOfFrames?(a.paused&&(a.paused=!1,a.startAutoPlay()),a.nextFrameID=a.currentFrame.index()+1!=a.numberOfFrames?a.currentFrameID+1:1,a.goTo(a.nextFrameID,1)):a.settings.autoPlayDirection==1&&(a.paused=!0,a.stopAutoPlay()))},prev:function(){var a=this;a.active||(a.settings.cycle||!a.settings.cycle&&a.currentFrame.index()+1!=1?(a.paused&&(a.paused=!1,a.startAutoPlay()),a.nextFrameID=a.currentFrame.index()+1==1?a.numberOfFrames:a.currentFrameID-1,a.goTo(a.nextFrameID,-1)):a.settings.autoPlayDirection==-1&&(a.paused=!0,a.stopAutoPlay()))},goTo:function(a,b){var c=this;a==c.numberOfFrames?c.settings.beforeLastFrameAnimatesIn():a==1&&c.settings.beforeFirstFrameAnimatesIn();if(a==c.currentFrame.index()+1)return!1;if(!c.active){c.active=!0,c.currentFrame=c.sequence.children(".current"),nextFrame=c.sequence.children("li:nth-child("+a+")"),b==undefined?c.direction=a>c.currentFrameID?1:-1:c.direction=b,frameChildren=c.currentFrame.children(),nextFrameChildren=nextFrame.children();if(c.transitionsSupported){c.settings.beforeCurrentFrameAnimatesOut(),c.animateOut(c.direction),animateIn=function(){c.animateIn(c.direction),c.currentFrameID=a};switch(c.settings.delayDuringOutInTransitions){case!0:c.waitForAnimationsToComplete(frameChildren,animateIn);break;case!1:animateIn();break;default:setTimeout(animateIn,c.settings.delayDuringOutInTransitions)}}else c.sequence.children("li").css({position:"relative"}),c.currentFrame.animate({opacity:0},c.settings.fallbackTheme.speed,function(){c.currentFrame.css({display:"none","z-index":"1"}),c.currentFrame.removeClass("current"),c.settings.beforeNextFrameAnimatesIn(),nextFrame.addClass("current").css({display:"block","z-index":c.numberOfFrames}).animate({opacity:1},500),c.currentFrame=nextFrame,c.currentFrameID=c.currentFrame.index()+1,c.active=!1,c.settings.autoPlay&&(autoPlaySequence=function(){c.autoPlaySequence()},clearTimeout(c.sequenceTimer),c.sequenceTimer=setTimeout(autoPlaySequence,c.settings.autoPlayDelay,c))})}},animateOut:function(b){var c=this;c.settings.beforeCurrentFrameAnimatesIn();if(!c.settings.reverseAnimationsWhenNavigatingBackwards||b==1)c.modifyElements(nextFrameChildren,"0s"),nextFrameChildren.removeClass("animate-out"),c.modifyElements(frameChildren,""),c.settings.disableAnimateOut||frameChildren.addClass("animate-out").removeClass("animate-in");c.settings.reverseAnimationsWhenNavigatingBackwards&&b==-1&&(c.modifyElements(nextFrameChildren,"0s"),c.settings.disableAnimateOut?c.active=!1:nextFrameChildren.addClass("animate-out"),c.modifyElements(frameChildren,""),frameChildren.each(function(){c.prefix=="-o-"?(selector="."+a(this).attr("class").replace(" ","."),previousFrameTransitionProperties=c.getStyleBySelector(selector),c.transitionProperties["transition-duration"]=previousFrameTransitionProperties["-o-transition-duration"],c.transitionProperties["transition-delay"]=previousFrameTransitionProperties["-o-transition-delay"],c.transitionProperties["transition-delay"]=c.transitionProperties["transition-delay"]==""?"0s":c.transitionProperties["transition-delay"]):(c.transitionProperties["transition-duration"]=a(this).css(c.prefix+"transition-duration"),c.transitionProperties["transition-delay"]=a(this).css(c.prefix+"transition-delay")),a(this).css(c.prefixCSS(c.prefix,c.transitionProperties)).removeClass("animate-in")}))},waitForAnimationsToComplete:function(b,c){var d=this;elementsAnimated={},b.each(function(){elementsAnimated[a(this).attr("class")]=!1}),d.currentFrame.bind(d.transitionEnd,function(a){elementsAnimated[a.target.className]=!0,total=0;for(element in elementsAnimated)elementsAnimated[element]==1&&total++;total==b.length&&c()})},animateIn:function(a){var b=this;b.currentFrame.removeClass("current"),b.currentFrame.unbind(b.transitionEnd),nextFrame.addClass("current"),b.currentFrame=nextFrame,a==1?b.currentFrameID=b.currentFrameID!=b.numberOfFrames?b.currentFrameID+1:1:b.currentFrameID=b.currentFrameID!=1?b.currentFrameID-1:b.numberOfFrames,nextFrameChildren=nextFrame.children(),frameChildren=b.currentFrame.children(),b.settings.beforeNextFrameAnimatesIn();if(!b.settings.reverseAnimationsWhenNavigatingBackwards||a==1)b.modifyElements(nextFrameChildren,"0s"),nextFrameChildren.removeClass("animate-out"),setTimeout(function(){frameChildren.removeClass("animate-out"),b.modifyElements(frameChildren,""),frameChildren.addClass("animate-in"),whenAnimationEnds()},50);b.settings.reverseAnimationsWhenNavigatingBackwards&&a==-1&&setTimeout(function(){b.modifyElements(frameChildren,""),frameChildren.addClass("animate-in").removeClass("animate-out"),whenAnimationEnds()},50),whenAnimationEnds=function(){unbind=function(){b.settings.afterNextFrameAnimatesIn(),b.currentFrameID==b.numberOfFrames?b.settings.afterLastFrameAnimatesIn():b.currentFrameID==1&&b.settings.afterFirstFrameAnimatesIn(),b.currentFrame.unbind(b.transitionEnd),b.active=!1,b.settings.autoPlay&&(autoPlaySequence=function(){b.autoPlaySequence()},clearTimeout(b.sequenceTimer),b.sequenceTimer=setTimeout(autoPlaySequence,b.settings.autoPlayDelay,b))},b.waitForAnimationsToComplete(nextFrameChildren,unbind)}}},a.fn.sequence=function(e){return this.each(function(){var f=new b(a(this),e,d,c);a(this).data("sequence",f)})};var c={modernizr:function(){window.Modernizr=function(a,b,c){function d(a){p.cssText=a}function e(a,b){return d(prefixes.join(a+";")+(b||""))}function f(a,b){return typeof a===b}function g(a,b){return!!~(""+a).indexOf(b)}function h(a,b){for(var d in a)if(p[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function i(a,b,d){for(var e in a){var g=b[a[e]];if(g!==c)return d===!1?a[e]:f(g,"function")?g.bind(d||b):g}return!1}function j(a,b,c){var d=a.charAt(0).toUpperCase()+a.substr(1),e=(a+" "+t.join(d+" ")+d).split(" ");return f(b,"string")||f(b,"undefined")?h(e,b):(e=(a+" "+u.join(d+" ")+d).split(" "),i(e,b,c))}var k="2.5.3",l={},m=b.documentElement,n="modernizr",o=b.createElement(n),p=o.style,q,r={}.toString,s="Webkit Moz O ms",t=s.split(" "),u=s.toLowerCase().split(" "),v={},w={},x={},y=[],z=y.slice,A,B={}.hasOwnProperty,C;!f(B,"undefined")&&!f(B.call,"undefined")?C=function(a,b){return B.call(a,b)}:C=function(a,b){return b in a&&f(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(a){var b=self;if(typeof b!="function")throw new TypeError;var c=z.call(arguments,1),d=function(){if(self instanceof d){var e=function(){};e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(z.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(z.call(arguments)))};return d});for(var D in v)C(v,D)&&(A=D.toLowerCase(),l[A]=v[D](),y.push((l[A]?"":"no-")+A));return d(""),o=q=null,l._version=k,l._domPrefixes=u,l._cssomPrefixes=t,l.testProp=function(a){return h([a])},l.testAllProps=j,l.prefixed=function(a,b,c){return b?j(a,b,c):j(a,"pfx")},l}(self,self.document)},defaultPreloader:function(b,c,d){opacity=c?0:1,a("head").append("<style>#sequence-preloader{height: 100%;position: absolute;width: 100%;z-index: 999999;}@"+d+"keyframes preload{0%{opacity: 0;}50%{opacity: 1;}100%{opacity: 0;}}#sequence-preloader img{background: #ff9933;border-radius: 6px;display: inline-block;height: 12px;opacity: "+opacity+";position: relative;top: -50%;width: 12px;"+d+"animation: preload 1s infinite; animation: preload 1s infinite;}.preloading{height: 12px;margin: 0 auto;top: 50%;position: relative;width: 48px;}#sequence-preloader img:nth-child(2){"+d+"animation-delay: .15s; animation-delay: .15s;}#sequence-preloader img:nth-child(3){"+d+"animation-delay: .3s; animation-delay: .3s;}.preloading-complete{opacity: 0;visibility: hidden;"+d+"transition-duration: 1s; transition-duration: 1s;}</style>"),a(b).prepend('<div id="sequence-preloader"><div class="preloading"><img src="images/sequence-preloader.png" alt="Sequence is loading, please wait..." /> <img src="images/sequence-preloader.png" alt="Sequence is loading, please wait..." /> <img src="images/sequence-preloader.png" alt="Sequence is loading, please wait..." /></div></div>')}},d={nextButton:".next",prependNextButton:!0,nextButtonSrc:"images/bt-next.png",nextButtonAlt:"&#gt;",showNextButtonOnInit:!0,prevButton:".prev",prependPrevButton:!0,prevButtonSrc:"images/bt-prev.png",prevButtonAlt:"&#lt;",showPrevButtonOnInit:!0,preloader:!0,prependPreloader:!0,prependPreloadingComplete:!0,hidePreloaderUsingCSS:!0,hidePreloaderDelay:0,startingFrameID:1,autoPlay:!0,autoPlayDirection:1,animatestartingFrameIn:!1,autoPlayDelay:5e3,pauseOnHover:!0,pauseIcon:!1,prependPauseIcon:!0,pauseIconSrc:"images/pause-icon.png",pauseAlt:"Pause",keysNavigate:!0,delayDuringOutInTransitions:1e3,touchEnabled:!0,swipeThreshold:15,cycle:!0,disableAnimateOut:!1,reverseAnimationsWhenNavigatingBackwards:!0,pauseOnElementsOutsideContainer:!1,fallbackTheme:{speed:500},beforeCurrentFrameAnimatesOut:function(){},beforeNextFrameAnimatesIn:function(){},afterNextFrameAnimatesIn:function(){},beforeCurrentFrameAnimatesIn:function(){},beforeFirstFrameAnimatesIn:function(){},afterFirstFrameAnimatesIn:function(){},beforeLastFrameAnimatesIn:function(){},afterLastFrameAnimatesIn:function(){},afterPreload:function(){}}})(jQuery);
6 scripts/sequence.jquery.js
@@ -122,7 +122,7 @@ Aside from these comments, you may modify and distribute this file as you please
122 122 self.sequence.children("li").children().removeClass("animate-in");
123 123 }
124 124
125   - if(options.preloader != false){
  125 + if(self.settings.preloader){
126 126 $(window).bind("load", function(){
127 127 self.settings.afterPreload();
128 128 if(self.settings.hidePreloaderUsingCSS && self.transitionsSupported && self.prefix != "-o-"){
@@ -142,6 +142,8 @@ Aside from these comments, you may modify and distribute this file as you please
142 142 }
143 143
144 144 function init(){
  145 + $("#sequence-preloader").remove();
  146 +
145 147 self.settings.nextButton = self.init.uiElements(self.settings.prependNextButton, options.nextButton, defaults.nextButton, self.settings.nextButtonSrc, self.settings.nextButtonAlt);
146 148 self.settings.prevButton = self.init.uiElements(self.settings.prependPrevButton, options.prevButton, defaults.prevButton, self.settings.prevButtonSrc, self.settings.prevButtonAlt);
147 149
@@ -167,7 +169,7 @@ Aside from these comments, you may modify and distribute this file as you please
167 169 self.direction;
168 170
169 171 self.sequence.css({"width": "100%", "height": "100%"}); //set the sequence list to 100% width/height just incase it hasn't been specified in the CSS
170   -
  172 +
171 173 if(self.transitionsSupported){ //initiate the full featured Sequence if transitions are supported...
172 174 whenFirstAnimateInEnds = function(){
173 175 animationComplete = function(){

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.