From 1b620b4dd63cb6e7e229872f97e5e375a8ca4eed Mon Sep 17 00:00:00 2001 From: Ian Lunn Date: Wed, 16 May 2012 22:55:54 +0100 Subject: [PATCH] 0.6.6 Bug fix and documentation change for using multiple instances of Sequence on the same page --- README.md | 5 +++++ documentation.html | 16 ++++++++-------- scripts/sequence.jquery-min.js | 4 ++-- scripts/sequence.jquery.js | 14 +++++++------- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 0ba7fab..ac6ade7 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,11 @@ http://www.opensource.org/licenses/mit-license.php | http://www.gnu.org/licenses ##What's New? +###v0.6.6 16/05/2012 + +####Bug fix for Multiple Instances of Sequence +The documentation has been slightly modified to better assist with multiple instances of Sequence on the same page. The default Sequence preloader was originally appended to the Sequence container as an ID but this caused issues when using more than one Sequence instance, so it's now a class. + ###v0.6.5 14/05/2012 **Note: 0.6.5 may not be backwards compatible with existing themes if those themes use the delayDuringOutInTransitions setting, which has now been renamed to transitionThreshold** diff --git a/documentation.html b/documentation.html index 902384e..8d0203e 100644 --- a/documentation.html +++ b/documentation.html @@ -172,7 +172,7 @@

Initiate Sequence

<script type="text/javascript"> 
     $(document).ready(function(){
         var sequence = $("#sequence").sequence(options).data("sequence");
-        var sequence2 = $("#sequence2").sequence(options2).data("sequence2");
+        var sequence2 = $("#sequence2").sequence(options2).data("sequence");
     }
 </script>
@@ -466,7 +466,7 @@

Specifying Options

autoPlayDelay: 3000 } var sequence = $("#sequence").sequence(options).data("sequence"); - var sequence2 = $("#sequence2").sequence(options).data("sequence2"); + var sequence2 = $("#sequence2").sequence(options).data("sequence"); } </script> @@ -484,7 +484,7 @@

Specifying Options

autoPlayDelay: 5000 } var sequence = $("#sequence").sequence(options).data("sequence"); - var sequence2 = $("#sequence2").sequence(options2).data("sequence2"); + var sequence2 = $("#sequence2").sequence(options2).data("sequence"); } </script> @@ -771,11 +771,11 @@

Preloader Options

true/false or a CSS Selector true - true: Use the default preloader and styles
+ true: Use the default preloader and styles (".sequence-preloader")
false: don't use a preloader
CSS Selector: Specify a CSS Selector to use as the preloader

If true, the following default preloading styles will be applied to the document: -
#sequence-preloader{
+							
.sequence-preloader{
 	height: 100%;
 	position: absolute;
 	width: 100%;
@@ -796,7 +796,7 @@ 

Preloader Options

} } -#sequence-preloader img{ +.sequence-preloader img{ background: #ff9933; border-radius: 6px; display: inline-block; @@ -816,11 +816,11 @@

Preloader Options

width: 48px; } -#sequence-preloader img:nth-child(2){ +.sequence-preloader img:nth-child(2){ -*-animation-delay: .15s; } -#sequence-preloader img:nth-child(3){ +.sequence-preloader img:nth-child(3){ -*-animation-delay: .3s; } diff --git a/scripts/sequence.jquery-min.js b/scripts/sequence.jquery-min.js index 613941b..e4f0a56 100644 --- a/scripts/sequence.jquery-min.js +++ b/scripts/sequence.jquery-min.js @@ -1,6 +1,6 @@ /* Sequence.js (www.sequencejs.com) -Version: 0.6.5 Beta +Version: 0.6.6 Beta Author: Ian Lunn @IanLunn Author URL: http://www.ianlunn.co.uk/ Github: https://github.com/IanLunn/Sequence @@ -10,4 +10,4 @@ http://www.opensource.org/licenses/mit-license.php | http://www.gnu.org/licenses Sequence.js and its dependencies are (c) Ian Lunn Design 2012 unless otherwise stated. Aside from these comments, you may modify and distribute this file as you please. Have fun! -*/(function(a){function b(b,c,d,e){function j(){function d(b){f.containerLeft=f.container.position().left;f.containerRight=f.container.position().left+f.container.width();f.containerTop=f.container.position().top;f.containerBottom=f.container.position().top+f.container.height();var c=b.pageX,d=b.pageY;if(c>=f.containerLeft&&c<=f.containerRight&&d>=f.containerTop&&d<=f.containerBottom){f.settings.autoPlay=!1;clearTimeout(f.sequenceTimer);a(f.settings.pauseIcon).show();f.settings.pauseButton!==undefined&&f.settings.pauseButton.addClass("paused");f.settings.paused();f.sequence.unbind("mousemove")}}a(f.settings.preloader).remove();f.settings.nextButton=f.init.uiElements(f.settings.prependNextButton,f.settings.nextButton,".next",f.settings.nextButtonSrc,f.settings.nextButtonAlt);f.settings.prevButton=f.init.uiElements(f.settings.prependPrevButton,f.settings.prevButton,".prev",f.settings.prevButtonSrc,f.settings.prevButtonAlt);f.settings.pauseButton=f.init.uiElements(f.settings.prependPauseButton,f.settings.pauseButton,".pause",f.settings.pauseButtonSrc,f.settings.pauseButtonAlt);f.settings.nextButton!==undefined&&f.settings.nextButton!==!1&&f.settings.showNextButtonOnInit&&f.settings.nextButton.show();f.settings.prevButton!==undefined&&f.settings.prevButton!==!1&&f.settings.showPrevButtonOnInit&&f.settings.prevButton.show();f.settings.pauseButton!==undefined&&f.settings.pauseButton!==!1&&f.settings.pauseButton.show();if(f.settings.pauseIcon!==!1){f.settings.pauseIcon=f.init.uiElements(f.settings.prependPauseIcon,f.settings.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.nextFrame=f.sequence.children("li:nth-child("+f.settings.startingFrameID+")");f.nextFrameChildren=f.nextFrame.children();f.nextFrameID=f.settings.startingFrameID;f.sequence.children("li").children().removeClass("animate-in");f.direction;f.sequence.css({width:"100%",height:"100%"});if(f.transitionsSupported)if(!f.settings.animateStartingFrameIn){f.currentFrame=f.nextFrame;f.currentFrame.addClass("current-frame");f.currentFrameChildren=f.currentFrame.children();f.currentFrameID=f.settings.startingFrameID;f.modifyElements(f.currentFrameChildren,"0s");f.currentFrameChildren.addClass("animate-in");setTimeout(function(){f.modifyElements(f.currentFrameChildren,"")},100);if(f.settings.autoPlay){var b=function(){f.autoPlaySequence()};clearTimeout(f.sequenceTimer);f.sequenceTimer=setTimeout(b,f.settings.autoPlayDelay,f)}}else if(f.settings.reverseAnimationsWhenNavigatingBackwards&&f.settings.autoPlayDirection-1&&f.settings.animateStartingFrameIn){f.modifyElements(f.nextFrameChildren,"0s");f.nextFrameChildren.addClass("animate-out");f.goTo(1,-1)}else f.goTo(1,1);else{f.container.addClass("sequence-fallback");f.currentFrame=f.nextFrame;f.currentFrame.addClass("current-frame");f.settings.beforeNextFrameAnimatesIn();f.settings.afterNextFrameAnimatesIn();f.currentFrameChildren=f.currentFrame.children();f.currentFrameID=f.settings.startingFrameID;f.sequence.children("li").children().css("opacity","0").addClass("animate-in").animate({opacity:"1"},500);f.nextFrame.css("z-index",f.numberOfFrames);f.sequence.children(":not(li:nth-child("+f.settings.startingFrameID+"))").css({display:"none",opacity:0});if(f.settings.autoPlay){var b=function(){f.autoPlaySequence()};clearTimeout(f.sequenceTimer);f.sequenceTimer=setTimeout(b,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.pauseButton!==undefined&&f.settings.pauseButton.click(function(){f.pause()});if(f.settings.keyNavigation){var c={left:37,right:39};a(document).keydown(function(a){function b(a,b){var d;for(keyCodes in b){keyCodes==="left"||keyCodes==="right"?d=c[keyCodes]:d=keyCodes;a===d&&f.initCustomKeyEvent(b[keyCodes])}}var d=parseFloat(String.fromCharCode(a.keyCode));if(d>0&&d<=f.numberOfFrames&&f.settings.numericKeysGoToFrames){f.nextFrameID=d;f.goTo(d)}b(a.keyCode,f.settings.keyEvents);b(a.keyCode,f.settings.customKeyEvents)})}if(f.settings.pauseOnHover&&!f.settings.pauseOnElementsOutsideContainer&&f.settings.autoPlay){f.hoverEvent=f.sequence.mousemove(function(a){d(a)});f.sequence.mouseleave(function(b){f.settings.autoPlay=!0;var c=function(){f.autoPlaySequence()};clearTimeout(f.sequenceTimer);f.sequenceTimer=setTimeout(c,f.settings.autoPlayDelay,f);a(f.settings.pauseIcon).hide();f.settings.pauseButton!==undefined&&f.settings.pauseButton.removeClass("paused");f.settings.unpaused();f.sequence.data("events").mousemove===undefined&&f.sequence.mousemove(function(a){d(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();f.settings.pauseButton!==undefined&&f.settings.pauseButton.addClass("paused");f.settings.paused()},function(){f.settings.autoPlay=!0;var b=function(){f.autoPlaySequence()};clearTimeout(f.sequenceTimer);f.sequenceTimer=setTimeout(b,f.settings.autoPlayDelay,f);a(f.settings.pauseIcon).hide();f.settings.pauseButton!==undefined&&f.settings.pauseButton.removeClass("paused");f.settings.unpaused()}));if(f.settings.swipeNavigation&&f.hasTouch){var e={touchstartX:-1,touchstartY:-1,touchmoveX:-1,touchmoveY:-1};f.sequence.on("touchstart touchmove touchend",function(a){f.settings.swipePreventsDefault&&a.preventDefault();switch(a.originalEvent.type){case"touchmove":case"touchstart":e[a.originalEvent.type+"X"]=a.originalEvent.touches[0].pageX;e[a.originalEvent.type+"Y"]=a.originalEvent.touches[0].pageY;break;case"touchend":if(e.touchmoveX!==-1){var b=e.touchmoveX-e.touchstartX,c=e.touchmoveY-e.touchstartY;Math.abs(b)>Math.abs(c)&&b>f.settings.calculatedSwipeThreshold?f.initCustomKeyEvent(f.settings.swipeEvents.right):Math.abs(b)>Math.abs(c)&&Math.abs(b)>f.settings.calculatedSwipeThreshold?f.initCustomKeyEvent(f.settings.swipeEvents.left):Math.abs(c)>Math.abs(b)&&c>f.settings.calculatedSwipeThreshold?f.initCustomKeyEvent(f.settings.swipeEvents.down):Math.abs(c)>Math.abs(b)&&Math.abs(c)>f.settings.calculatedSwipeThreshold&&f.initCustomKeyEvent(f.settings.swipeEvents.up);e={touchstartX:-1,touchstartY:-1,touchmoveX:-1,touchmoveY:-1}}break;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){f.prependTo=f.settings.prependPreloader==1?f.container:f.settings.prependPreloader;switch(b){case!0:case undefined:e.defaultPreloader(f.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){switch(c){case!1:return undefined;case!0:b===!0?a(f.container).prepend("'+g+''):b!==!1&&a(b).prepend("'+g+'');return a(d);default:var h=b==1?f.container:b;a(h).prepend("'+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);f.firstFrame=f.settings.animateStartingFrameIn?!0:!1;if(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();if(f.settings.hidePreloaderUsingCSS&&f.transitionsSupported&&f.prefix!=="-o-"){f.prependPreloadingCompleteTo=f.settings.prependPreloadingComplete==1?f.settings.preloader:a(f.settings.prependPreloadingComplete);f.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 d(){c=c===1?0:1;a("#sequence-preloader img:nth-child(1)").animate({opacity:c},100);a("#sequence-preloader img:nth-child(2)").animate({opacity:c},350);a("#sequence-preloader img:nth-child(3)").animate({opacity:c},600)}var b=this,c=0;d();b.defaultPreloader=setInterval(function(){d()},600)},initCustomKeyEvent:function(a){var b=this;switch(a){case"next":b.next();break;case"prev":b.prev();break;case"pause":b.pause()}},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){var c={};for(property in b)c[a+property]=b[property];return c},getStyleBySelector:function(a){var b={},c=document.styleSheets,d,e,f;for(e=c.length-1;e>=0;e--){var g=!1;try{d=c[e].cssRules}catch(h){g=!0}if(!g)for(f=0;fc.currentFrameID?1:-1:c.direction=b;c.frameChildren=c.currentFrame.children();c.nextFrameChildren=c.nextFrame.children();if(c.transitionsSupported){if(c.currentFrame.length!==0){c.settings.beforeCurrentFrameAnimatesOut();c.animateOut(c.direction)}var d=function(){c.animateIn(c.direction);c.currentFrameID=a};if(!c.firstFrame)switch(c.settings.transitionThreshold){case!0:c.waitForAnimationsToComplete(c.currentFrame,c.frameChildren,"out");break;case!1:d();break;default:setTimeout(d,c.settings.transitionThreshold)}else{d();c.firstFrame=!1}}else{c.sequence.children("li").css({position:"relative"});c.settings.beforeCurrentFrameAnimatesOut();c.currentFrame.animate({opacity:0},c.settings.fallbackTheme.speed,function(){c.currentFrame.css({display:"none","z-index":"1"});c.currentFrame.removeClass("current-frame");c.settings.beforeNextFrameAnimatesIn();c.nextFrame.addClass("current-frame").css({display:"block","z-index":c.numberOfFrames}).animate({opacity:1},500,function(){c.settings.afterNextFrameAnimatesIn()});c.currentFrame=c.nextFrame;c.currentFrameID=c.currentFrame.index()+1;c.active=!1;if(c.settings.autoPlay){var a=function(){c.autoPlaySequence()};clearTimeout(c.sequenceTimer);c.sequenceTimer=setTimeout(a,c.settings.autoPlayDelay,c)}})}}},animateOut:function(a){var b=this;b.currentFrame.removeClass("current-frame");b.nextFrame.addClass("next-frame");if(!b.settings.reverseAnimationsWhenNavigatingBackwards||a===1){b.modifyElements(b.nextFrameChildren,"0s");b.nextFrameChildren.removeClass("animate-out");b.modifyElements(b.frameChildren,"");b.frameChildren.addClass("animate-out").removeClass("animate-in")}if(b.settings.reverseAnimationsWhenNavigatingBackwards&&a===-1){b.modifyElements(b.nextFrameChildren,"0s");b.nextFrameChildren.addClass("animate-out");b.setTransitionProperties(b.frameChildren);b.frameChildren.removeClass("animate-in")}b.settings.transitionThreshold&&b.waitForAnimationsToComplete(b.currentFrame,b.currentFrame.children(),"out",!0)},animateIn:function(a){var b=this;b.currentFrame.unbind(b.transitionEnd);b.currentFrame=b.nextFrame;a===1?b.currentFrameID=b.currentFrameID!==b.numberOfFrames?b.currentFrameID+1:1:b.currentFrameID=b.currentFrameID!==1?b.currentFrameID-1:b.numberOfFrames;b.nextFrameChildren=b.nextFrame.children();b.frameChildren=b.currentFrame.children();b.settings.beforeNextFrameAnimatesIn();if(!b.settings.reverseAnimationsWhenNavigatingBackwards||a===1){b.modifyElements(b.nextFrameChildren,"0s");b.nextFrameChildren.removeClass("animate-out");setTimeout(function(){b.frameChildren.removeClass("animate-out");b.modifyElements(b.frameChildren,"");b.frameChildren.addClass("animate-in");b.waitForAnimationsToComplete(b.nextFrame,b.nextFrameChildren,"in");b.settings.transitionThreshold!==!0&&b.settings.afterCurrentFrameAnimatesOut!="function () {}"&&b.waitForAnimationsToComplete(b.currentFrame,b.currentFrame.children(),"out")},50)}else b.settings.reverseAnimationsWhenNavigatingBackwards&&a===-1&&setTimeout(function(){b.setTransitionProperties(b.frameChildren);b.frameChildren.addClass("animate-in").removeClass("animate-out");b.waitForAnimationsToComplete(b.nextFrame,b.nextFrameChildren,"in");b.settings.transitionThreshold!==!0&&b.settings.afterCurrentFrameAnimatesOut!="function () {}"&&b.waitForAnimationsToComplete(b.currentFrame,b.currentFrame.children(),"out")},50)},waitForAnimationsToComplete:function(b,c,d,e){var f=this;if(d==="out")var g=function(){f.active=!1;b.unbind(f.transitionEnd);f.settings.afterCurrentFrameAnimatesOut();e&&f.animateIn(f.direction)};else if(d==="in")var g=function(){b.unbind(f.transitionEnd);f.settings.afterNextFrameAnimatesIn();f.currentFrameID===f.numberOfFrames?f.settings.afterLastFrameAnimatesIn():f.currentFrameID===1&&f.settings.afterFirstFrameAnimatesIn();f.nextFrame.removeClass("next-frame").addClass("current-frame");f.active=!1;if(f.settings.autoPlay){var a=function(){f.autoPlaySequence()};clearTimeout(f.sequenceTimer);f.sequenceTimer=setTimeout(a,f.settings.autoPlayDelay,f)}};c.each(function(){a(this).data("animationEnded",!1)});f.currentFrame.bind(f.transitionEnd,function(b){a(b.target).data("animationEnded",!0);var d=!0;c.each(function(){a(this).data("animationEnded")===!1&&(d=!1)});d&&g()})}};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){var e=c?0:1;a("head").append("");a(b).prepend('
Sequence is loading, please wait... Sequence is loading, please wait... Sequence is loading, please wait...
')}},d={startingFrameID:1,cycle:!0,animateStartingFrameIn:!1,transitionThreshold:1e3,reverseAnimationsWhenNavigatingBackwards:!0,autoPlay:!0,autoPlayDirection:1,autoPlayDelay:5e3,nextButton:!1,prependNextButton:!1,nextButtonSrc:"images/bt-next.png",nextButtonAlt:"&#gt;",showNextButtonOnInit:!0,prevButton:!1,prependPrevButton:!1,prevButtonSrc:"images/bt-prev.png",prevButtonAlt:"&#lt;",showPrevButtonOnInit:!0,pauseButton:!1,prependPauseButton:!1,pauseButtonSrc:"images/bt-pause.png",pauseButtonAlt:"¦¦",unpauseDelay:0,pauseOnHover:!0,pauseIcon:!1,prependPauseIcon:!1,pauseIconSrc:"images/pause-icon.png",pauseAlt:"Pause",pauseOnElementsOutsideContainer:!1,preloader:!0,prependPreloader:!0,prependPreloadingComplete:!0,hidePreloaderUsingCSS:!0,hidePreloaderDelay:0,keyNavigation:!0,numericKeysGoToFrames:!0,keyPreventsDefault:!1,keyEvents:{left:"prev",right:"next"},customKeyEvents:{},swipeNavigation:!0,swipeThreshold:15,swipePreventsDefault:!1,swipeEvents:{left:"prev",right:"next",up:!1,down:!1},fallbackTheme:{speed:500},paused:function(){},unpaused:function(){},beforeNextFrameAnimatesIn:function(){},afterNextFrameAnimatesIn:function(){},beforeCurrentFrameAnimatesOut:function(){},afterCurrentFrameAnimatesOut:function(){},beforeFirstFrameAnimatesIn:function(){},afterFirstFrameAnimatesIn:function(){},beforeLastFrameAnimatesIn:function(){},afterLastFrameAnimatesIn:function(){},afterPreload:function(){}}})(jQuery); \ No newline at end of file +*/(function(a){function b(b,c,d,e){function j(){function d(b){f.containerLeft=f.container.position().left;f.containerRight=f.container.position().left+f.container.width();f.containerTop=f.container.position().top;f.containerBottom=f.container.position().top+f.container.height();var c=b.pageX,d=b.pageY;if(c>=f.containerLeft&&c<=f.containerRight&&d>=f.containerTop&&d<=f.containerBottom){f.settings.autoPlay=!1;clearTimeout(f.sequenceTimer);a(f.settings.pauseIcon).show();f.settings.pauseButton!==undefined&&f.settings.pauseButton.addClass("paused");f.settings.paused();f.sequence.unbind("mousemove")}}a(f.settings.preloader).remove();f.settings.nextButton=f.init.uiElements(f.settings.prependNextButton,f.settings.nextButton,".next",f.settings.nextButtonSrc,f.settings.nextButtonAlt);f.settings.prevButton=f.init.uiElements(f.settings.prependPrevButton,f.settings.prevButton,".prev",f.settings.prevButtonSrc,f.settings.prevButtonAlt);f.settings.pauseButton=f.init.uiElements(f.settings.prependPauseButton,f.settings.pauseButton,".pause",f.settings.pauseButtonSrc,f.settings.pauseButtonAlt);f.settings.nextButton!==undefined&&f.settings.nextButton!==!1&&f.settings.showNextButtonOnInit&&f.settings.nextButton.show();f.settings.prevButton!==undefined&&f.settings.prevButton!==!1&&f.settings.showPrevButtonOnInit&&f.settings.prevButton.show();f.settings.pauseButton!==undefined&&f.settings.pauseButton!==!1&&f.settings.pauseButton.show();if(f.settings.pauseIcon!==!1){f.settings.pauseIcon=f.init.uiElements(f.settings.prependPauseIcon,f.settings.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.nextFrame=f.sequence.children("li:nth-child("+f.settings.startingFrameID+")");f.nextFrameChildren=f.nextFrame.children();f.nextFrameID=f.settings.startingFrameID;f.sequence.children("li").children().removeClass("animate-in");f.direction;f.sequence.css({width:"100%",height:"100%"});if(f.transitionsSupported)if(!f.settings.animateStartingFrameIn){f.currentFrame=f.nextFrame;f.currentFrame.addClass("current-frame");f.currentFrameChildren=f.currentFrame.children();f.currentFrameID=f.settings.startingFrameID;f.modifyElements(f.currentFrameChildren,"0s");f.currentFrameChildren.addClass("animate-in");setTimeout(function(){f.modifyElements(f.currentFrameChildren,"")},100);if(f.settings.autoPlay){var b=function(){f.autoPlaySequence()};clearTimeout(f.sequenceTimer);f.sequenceTimer=setTimeout(b,f.settings.autoPlayDelay,f)}}else if(f.settings.reverseAnimationsWhenNavigatingBackwards&&f.settings.autoPlayDirection-1&&f.settings.animateStartingFrameIn){f.modifyElements(f.nextFrameChildren,"0s");f.nextFrameChildren.addClass("animate-out");f.goTo(1,-1)}else f.goTo(1,1);else{f.container.addClass("sequence-fallback");f.currentFrame=f.nextFrame;f.currentFrame.addClass("current-frame");f.settings.beforeNextFrameAnimatesIn();f.settings.afterNextFrameAnimatesIn();f.currentFrameChildren=f.currentFrame.children();f.currentFrameID=f.settings.startingFrameID;f.sequence.children("li").children().css("opacity","0").addClass("animate-in").animate({opacity:"1"},500);f.nextFrame.css("z-index",f.numberOfFrames);f.sequence.children(":not(li:nth-child("+f.settings.startingFrameID+"))").css({display:"none",opacity:0});if(f.settings.autoPlay){var b=function(){f.autoPlaySequence()};clearTimeout(f.sequenceTimer);f.sequenceTimer=setTimeout(b,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.pauseButton!==undefined&&f.settings.pauseButton.click(function(){f.pause()});if(f.settings.keyNavigation){var c={left:37,right:39};a(document).keydown(function(a){function b(a,b){var d;for(keyCodes in b){keyCodes==="left"||keyCodes==="right"?d=c[keyCodes]:d=keyCodes;a===d&&f.initCustomKeyEvent(b[keyCodes])}}var d=parseFloat(String.fromCharCode(a.keyCode));if(d>0&&d<=f.numberOfFrames&&f.settings.numericKeysGoToFrames){f.nextFrameID=d;f.goTo(d)}b(a.keyCode,f.settings.keyEvents);b(a.keyCode,f.settings.customKeyEvents)})}if(f.settings.pauseOnHover&&!f.settings.pauseOnElementsOutsideContainer&&f.settings.autoPlay){f.hoverEvent=f.sequence.mousemove(function(a){d(a)});f.sequence.mouseleave(function(b){f.settings.autoPlay=!0;var c=function(){f.autoPlaySequence()};clearTimeout(f.sequenceTimer);f.sequenceTimer=setTimeout(c,f.settings.autoPlayDelay,f);a(f.settings.pauseIcon).hide();f.settings.pauseButton!==undefined&&f.settings.pauseButton.removeClass("paused");f.settings.unpaused();f.sequence.data("events").mousemove===undefined&&f.sequence.mousemove(function(a){d(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();f.settings.pauseButton!==undefined&&f.settings.pauseButton.addClass("paused");f.settings.paused()},function(){f.settings.autoPlay=!0;var b=function(){f.autoPlaySequence()};clearTimeout(f.sequenceTimer);f.sequenceTimer=setTimeout(b,f.settings.autoPlayDelay,f);a(f.settings.pauseIcon).hide();f.settings.pauseButton!==undefined&&f.settings.pauseButton.removeClass("paused");f.settings.unpaused()}));if(f.settings.swipeNavigation&&f.hasTouch){var e={touchstartX:-1,touchstartY:-1,touchmoveX:-1,touchmoveY:-1};f.sequence.on("touchstart touchmove touchend",function(a){f.settings.swipePreventsDefault&&a.preventDefault();switch(a.originalEvent.type){case"touchmove":case"touchstart":e[a.originalEvent.type+"X"]=a.originalEvent.touches[0].pageX;e[a.originalEvent.type+"Y"]=a.originalEvent.touches[0].pageY;break;case"touchend":if(e.touchmoveX!==-1){var b=e.touchmoveX-e.touchstartX,c=e.touchmoveY-e.touchstartY;Math.abs(b)>Math.abs(c)&&b>f.settings.calculatedSwipeThreshold?f.initCustomKeyEvent(f.settings.swipeEvents.right):Math.abs(b)>Math.abs(c)&&Math.abs(b)>f.settings.calculatedSwipeThreshold?f.initCustomKeyEvent(f.settings.swipeEvents.left):Math.abs(c)>Math.abs(b)&&c>f.settings.calculatedSwipeThreshold?f.initCustomKeyEvent(f.settings.swipeEvents.down):Math.abs(c)>Math.abs(b)&&Math.abs(c)>f.settings.calculatedSwipeThreshold&&f.initCustomKeyEvent(f.settings.swipeEvents.up);e={touchstartX:-1,touchstartY:-1,touchmoveX:-1,touchmoveY:-1}}break;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){f.prependTo=f.settings.prependPreloader==1?f.container:f.settings.prependPreloader;switch(b){case!0:case undefined:e.defaultPreloader(f.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){switch(c){case!1:return undefined;case!0:b===!0?a(f.container).prepend("'+g+''):b!==!1&&a(b).prepend("'+g+'');return a(d);default:var h=b==1?f.container:b;a(h).prepend("'+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);f.firstFrame=f.settings.animateStartingFrameIn?!0:!1;if(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();if(f.settings.hidePreloaderUsingCSS&&f.transitionsSupported&&f.prefix!=="-o-"){f.prependPreloadingCompleteTo=f.settings.prependPreloadingComplete==1?f.settings.preloader:a(f.settings.prependPreloadingComplete);f.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 d(){c=c===1?0:1;a(".sequence-preloader img:nth-child(1)").animate({opacity:c},100);a(".sequence-preloader img:nth-child(2)").animate({opacity:c},350);a(".sequence-preloader img:nth-child(3)").animate({opacity:c},600)}var b=this,c=0;d();b.defaultPreloader=setInterval(function(){d()},600)},initCustomKeyEvent:function(a){var b=this;switch(a){case"next":b.next();break;case"prev":b.prev();break;case"pause":b.pause()}},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){var c={};for(property in b)c[a+property]=b[property];return c},getStyleBySelector:function(a){var b={},c=document.styleSheets,d,e,f;for(e=c.length-1;e>=0;e--){var g=!1;try{d=c[e].cssRules}catch(h){g=!0}if(!g)for(f=0;fc.currentFrameID?1:-1:c.direction=b;c.frameChildren=c.currentFrame.children();c.nextFrameChildren=c.nextFrame.children();if(c.transitionsSupported){if(c.currentFrame.length!==0){c.settings.beforeCurrentFrameAnimatesOut();c.animateOut(c.direction)}var d=function(){c.animateIn(c.direction);c.currentFrameID=a};if(!c.firstFrame)switch(c.settings.transitionThreshold){case!0:c.waitForAnimationsToComplete(c.currentFrame,c.frameChildren,"out");break;case!1:d();break;default:setTimeout(d,c.settings.transitionThreshold)}else{d();c.firstFrame=!1}}else{c.sequence.children("li").css({position:"relative"});c.settings.beforeCurrentFrameAnimatesOut();c.currentFrame.animate({opacity:0},c.settings.fallbackTheme.speed,function(){c.currentFrame.css({display:"none","z-index":"1"});c.currentFrame.removeClass("current-frame");c.settings.beforeNextFrameAnimatesIn();c.nextFrame.addClass("current-frame").css({display:"block","z-index":c.numberOfFrames}).animate({opacity:1},500,function(){c.settings.afterNextFrameAnimatesIn()});c.currentFrame=c.nextFrame;c.currentFrameID=c.currentFrame.index()+1;c.active=!1;if(c.settings.autoPlay){var a=function(){c.autoPlaySequence()};clearTimeout(c.sequenceTimer);c.sequenceTimer=setTimeout(a,c.settings.autoPlayDelay,c)}})}}},animateOut:function(a){var b=this;b.currentFrame.removeClass("current-frame");b.nextFrame.addClass("next-frame");if(!b.settings.reverseAnimationsWhenNavigatingBackwards||a===1){b.modifyElements(b.nextFrameChildren,"0s");b.nextFrameChildren.removeClass("animate-out");b.modifyElements(b.frameChildren,"");b.frameChildren.addClass("animate-out").removeClass("animate-in")}if(b.settings.reverseAnimationsWhenNavigatingBackwards&&a===-1){b.modifyElements(b.nextFrameChildren,"0s");b.nextFrameChildren.addClass("animate-out");b.setTransitionProperties(b.frameChildren);b.frameChildren.removeClass("animate-in")}b.settings.transitionThreshold&&b.waitForAnimationsToComplete(b.currentFrame,b.currentFrame.children(),"out",!0)},animateIn:function(a){var b=this;b.currentFrame.unbind(b.transitionEnd);b.currentFrame=b.nextFrame;a===1?b.currentFrameID=b.currentFrameID!==b.numberOfFrames?b.currentFrameID+1:1:b.currentFrameID=b.currentFrameID!==1?b.currentFrameID-1:b.numberOfFrames;b.nextFrameChildren=b.nextFrame.children();b.frameChildren=b.currentFrame.children();b.settings.beforeNextFrameAnimatesIn();if(!b.settings.reverseAnimationsWhenNavigatingBackwards||a===1){b.modifyElements(b.nextFrameChildren,"0s");b.nextFrameChildren.removeClass("animate-out");setTimeout(function(){b.frameChildren.removeClass("animate-out");b.modifyElements(b.frameChildren,"");b.frameChildren.addClass("animate-in");b.waitForAnimationsToComplete(b.nextFrame,b.nextFrameChildren,"in");b.settings.transitionThreshold!==!0&&b.settings.afterCurrentFrameAnimatesOut!="function () {}"&&b.waitForAnimationsToComplete(b.currentFrame,b.currentFrame.children(),"out")},50)}else b.settings.reverseAnimationsWhenNavigatingBackwards&&a===-1&&setTimeout(function(){b.setTransitionProperties(b.frameChildren);b.frameChildren.addClass("animate-in").removeClass("animate-out");b.waitForAnimationsToComplete(b.nextFrame,b.nextFrameChildren,"in");b.settings.transitionThreshold!==!0&&b.settings.afterCurrentFrameAnimatesOut!="function () {}"&&b.waitForAnimationsToComplete(b.currentFrame,b.currentFrame.children(),"out")},50)},waitForAnimationsToComplete:function(b,c,d,e){var f=this;if(d==="out")var g=function(){f.active=!1;b.unbind(f.transitionEnd);f.settings.afterCurrentFrameAnimatesOut();e&&f.animateIn(f.direction)};else if(d==="in")var g=function(){b.unbind(f.transitionEnd);f.settings.afterNextFrameAnimatesIn();f.currentFrameID===f.numberOfFrames?f.settings.afterLastFrameAnimatesIn():f.currentFrameID===1&&f.settings.afterFirstFrameAnimatesIn();f.nextFrame.removeClass("next-frame").addClass("current-frame");f.active=!1;if(f.settings.autoPlay){var a=function(){f.autoPlaySequence()};clearTimeout(f.sequenceTimer);f.sequenceTimer=setTimeout(a,f.settings.autoPlayDelay,f)}};c.each(function(){a(this).data("animationEnded",!1)});f.currentFrame.bind(f.transitionEnd,function(b){a(b.target).data("animationEnded",!0);var d=!0;c.each(function(){a(this).data("animationEnded")===!1&&(d=!1)});d&&g()})}};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){var e=c?0:1;a("head").append("");a(b).prepend('
Sequence is loading, please wait... Sequence is loading, please wait... Sequence is loading, please wait...
')}},d={startingFrameID:1,cycle:!0,animateStartingFrameIn:!1,transitionThreshold:1e3,reverseAnimationsWhenNavigatingBackwards:!0,autoPlay:!0,autoPlayDirection:1,autoPlayDelay:5e3,nextButton:!1,prependNextButton:!1,nextButtonSrc:"images/bt-next.png",nextButtonAlt:"&#gt;",showNextButtonOnInit:!0,prevButton:!1,prependPrevButton:!1,prevButtonSrc:"images/bt-prev.png",prevButtonAlt:"&#lt;",showPrevButtonOnInit:!0,pauseButton:!1,prependPauseButton:!1,pauseButtonSrc:"images/bt-pause.png",pauseButtonAlt:"¦¦",unpauseDelay:0,pauseOnHover:!0,pauseIcon:!1,prependPauseIcon:!1,pauseIconSrc:"images/pause-icon.png",pauseAlt:"Pause",pauseOnElementsOutsideContainer:!1,preloader:!0,prependPreloader:!0,prependPreloadingComplete:!0,hidePreloaderUsingCSS:!0,hidePreloaderDelay:0,keyNavigation:!0,numericKeysGoToFrames:!0,keyPreventsDefault:!1,keyEvents:{left:"prev",right:"next"},customKeyEvents:{},swipeNavigation:!0,swipeThreshold:15,swipePreventsDefault:!1,swipeEvents:{left:"prev",right:"next",up:!1,down:!1},fallbackTheme:{speed:500},paused:function(){},unpaused:function(){},beforeNextFrameAnimatesIn:function(){},afterNextFrameAnimatesIn:function(){},beforeCurrentFrameAnimatesOut:function(){},afterCurrentFrameAnimatesOut:function(){},beforeFirstFrameAnimatesIn:function(){},afterFirstFrameAnimatesIn:function(){},beforeLastFrameAnimatesIn:function(){},afterLastFrameAnimatesIn:function(){},afterPreload:function(){}}})(jQuery); \ No newline at end of file diff --git a/scripts/sequence.jquery.js b/scripts/sequence.jquery.js index f9571e4..29013ae 100644 --- a/scripts/sequence.jquery.js +++ b/scripts/sequence.jquery.js @@ -1,6 +1,6 @@ /* Sequence.js (www.sequencejs.com) -Version: 0.6.5 Beta +Version: 0.6.6 Beta Author: Ian Lunn @IanLunn Author URL: http://www.ianlunn.co.uk/ Github: https://github.com/IanLunn/Sequence @@ -63,7 +63,7 @@ Aside from these comments, you may modify and distribute this file as you please if(!self.transitionsSupported || self.prefix === "-o-"){ self.preloaderFallback(); } - return $("#sequence-preloader"); + return $(".sequence-preloader"); case false: break; @@ -393,9 +393,9 @@ Aside from these comments, you may modify and distribute this file as you please var self = this, i = 0; function preload(){ i = (i === 1) ? 0 : 1; - $("#sequence-preloader img:nth-child(1)").animate({"opacity": i}, 100); - $("#sequence-preloader img:nth-child(2)").animate({"opacity": i}, 350); - $("#sequence-preloader img:nth-child(3)").animate({"opacity": i}, 600); + $(".sequence-preloader img:nth-child(1)").animate({"opacity": i}, 100); + $(".sequence-preloader img:nth-child(2)").animate({"opacity": i}, 350); + $(".sequence-preloader img:nth-child(3)").animate({"opacity": i}, 600); } preload(); self.defaultPreloader = setInterval(function(){ @@ -821,8 +821,8 @@ Aside from these comments, you may modify and distribute this file as you please defaultPreloader: function(prependTo, transitions, prefix){ var opacity = (transitions) ? 0 : 1; - $("head").append(""); - $(prependTo).prepend('
Sequence is loading, please wait... Sequence is loading, please wait... Sequence is loading, please wait...
'); + $("head").append(""); + $(prependTo).prepend('
Sequence is loading, please wait... Sequence is loading, please wait... Sequence is loading, please wait...
'); } },