/* * Sequence.js * * The responsive CSS animation framework for creating unique sliders, * presentations, banners, and other step-based applications. * * @link https://github.com/IanLunn/Sequence * @author IanLunn * @version 2.1.0 * @license http://sequencejs.com/licenses/ * @copyright Ian Lunn Design Limited 2015 */ function defineSequence(e,t){"use strict";var n=[],i=0,a=function(a,o){var r=a.getAttribute("data-seq-enabled");if(null!==r)return n[r];a.setAttribute("data-seq-enabled",i),i++;var s={startingStepId:1,startingStepAnimatesIn:!1,cycle:!0,phaseThreshold:!0,reverseWhenNavigatingBackwards:!1,reverseTimingFunctionWhenNavigatingBackwards:!1,moveActiveStepToTop:!0,animateCanvas:!0,animateCanvasDuration:250,autoPlay:!1,autoPlayInterval:5e3,autoPlayDelay:null,autoPlayDirection:1,autoPlayButton:!0,autoPlayPauseOnHover:!0,navigationSkip:!0,navigationSkipThreshold:250,fadeStepWhenSkipped:!0,fadeStepTime:500,ignorePhaseThresholdWhenSkipped:!1,preventReverseSkipping:!1,nextButton:!0,prevButton:!0,pagination:!0,preloader:!1,preloadTheseSteps:[1],preloadTheseImages:[],hideStepsUntilPreloaded:!1,pausePreloader:!1,keyNavigation:!1,numericKeysGoToSteps:!1,keyEvents:{left:function(e){e.prev()},right:function(e){e.next()}},swipeNavigation:!0,swipeEvents:{left:function(e){e.next()},right:function(e){e.prev()},up:void 0,down:void 0},swipeHammerOptions:{},hashTags:!1,hashDataAttribute:!1,hashChangesOnFirstStep:!1,fallback:{speed:500}},l=50,u=100,p={animation:{WebkitAnimation:"-webkit-",animation:""}},d=function(e,t,n){function i(e){g.cssText=e}function a(e,t){return typeof e===t}function o(e,t){return!!~(""+e).indexOf(t)}function r(e,t){for(var i in e){var a=e[i];if(!o(a,"-")&&g[a]!==n)return"pfx"!=t||a}return!1}function s(e,t,i){for(var o in e){var r=t[e[o]];if(r!==n)return i===!1?e[o]:a(r,"function")?r.bind(i||t):r}return!1}function l(e,t,n){var i=e.charAt(0).toUpperCase()+e.slice(1),o=(e+" "+S.join(i+" ")+i).split(" ");return a(t,"string")||a(t,"undefined")?r(o,t):(o=(e+" "+P.join(i+" ")+i).split(" "),s(o,t,n))}var u,p,d,c="2.8.3",h={},f=t.documentElement,m="modernizr",v=t.createElement(m),g=v.style,y=({}.toString," -webkit- -moz- -o- -ms- ".split(" ")),T="Webkit Moz O ms",S=T.split(" "),P=T.toLowerCase().split(" "),w={svg:"http://www.w3.org/2000/svg"},b={},x=[],q=x.slice,k=function(e,n,i,a){var o,r,s,l,u=t.createElement("div"),p=t.body,d=p||t.createElement("body");if(parseInt(i,10))for(;i--;)s=t.createElement("div"),s.id=a?a[i]:m+(i+1),u.appendChild(s);return o=["­",'"].join(""),u.id=m,(p?u:d).innerHTML+=o,d.appendChild(u),p||(d.style.background="",d.style.overflow="hidden",l=f.style.overflow,f.style.overflow="hidden",f.appendChild(d)),r=n(u,e),p?u.parentNode.removeChild(u):(d.parentNode.removeChild(d),f.style.overflow=l),!!r},E={}.hasOwnProperty;d=a(E,"undefined")||a(E.call,"undefined")?function(e,t){return t in e&&a(e.constructor.prototype[t],"undefined")}:function(e,t){return E.call(e,t)},Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if("function"!=typeof t)throw new TypeError;var n=q.call(arguments,1),i=function(){if(this instanceof i){var a=function(){};a.prototype=t.prototype;var o=new a,r=t.apply(o,n.concat(q.call(arguments)));return Object(r)===r?r:o}return t.apply(e,n.concat(q.call(arguments)))};return i}),b.touch=function(){var n;return"ontouchstart"in e||e.DocumentTouch&&t instanceof DocumentTouch?n=!0:k(["@media (",y.join("touch-enabled),("),m,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(e){n=9===e.offsetTop}),n},b.cssanimations=function(){return l("animationName")},b.csstransforms=function(){return!!l("transform")},b.csstransitions=function(){return l("transition")},b.svg=function(){return!!t.createElementNS&&!!t.createElementNS(w.svg,"svg").createSVGRect};for(var $ in b)d(b,$)&&(p=$.toLowerCase(),h[p]=b[$](),x.push((h[p]?"":"no-")+p));return h.addTest=function(e,t){if("object"==typeof e)for(var i in e)d(e,i)&&h.addTest(i,e[i]);else{if(e=e.toLowerCase(),h[e]!==n)return h;t="function"==typeof t?t():t,"undefined"!=typeof enableClasses&&enableClasses&&(f.className+=" "+(t?"":"no-")+e),h[e]=t}return h},i(""),v=u=null,h._version=c,h._prefixes=y,h._domPrefixes=P,h._cssomPrefixes=S,h.testProp=function(e){return r([e])},h.testAllProps=l,h.testStyles=k,h.prefixed=function(e,t,n){return t?l(e,t,n):l(e,"pfx")},h}(window,window.document);Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){if(void 0===this||null===this)throw new TypeError('"this" is null or not defined');var n=this.length>>>0;for(t=+t||0,Math.abs(t)===1/0&&(t=0),t<0&&(t+=n,t<0&&(t=0));t-1?1:1e3,t="0s"==e?0:parseFloat(e.replace("s",""))*n,t}function S(e,t){if(void 0!==e)return new RegExp("(\\s|^)"+t+"(\\s|$)").test(e.className)}function P(e,t){var n,i,a;for(f(e)===!1&&(i=1,e=[e]),i=e.length,a=0;a=n.left&&t.clientX<=n.right&&t.clientY>=n.top&&t.clientY<=n.bottom&&(i=!0),i}function x(e,t,n){if("BODY"===t.nodeName)return!1;if(e!==t)return n=t,x(e,t.parentNode,n);if(void 0!==n)for(var i=n,a=e.getElementsByTagName(i.nodeName),o=a.length;o--;)if(i===a[o])return o+1}function q(e){var n=0,i=t.DIRECTION_NONE;return void 0===e.left&&void 0===e.right||(n+=1),void 0===e.up&&void 0===e.down||(n+=2),1===n?i=t.DIRECTION_HORIZONTAL:2===n?i=t.DIRECTION_VERTICAL:3===n&&(i=t.DIRECTION_ALL),i}function k(e,t){var n="seq-",i="no-touch";t.touch===!0&&(i="touch"),P(e,n+i)}var E={modernizr:d};return E.ui={defaultElements:{nextButton:"seq-next",prevButton:"seq-prev",autoPlayButton:"seq-autoplay",pagination:"seq-pagination",preloader:"seq-preloader"},getElements:function(e,t){var n,i,a,o,r,s=[];for(i=t===!0?document.querySelectorAll("."+this.defaultElements[e]):document.querySelectorAll(t),a=i.length,r=0;r0?s=o:o<0&&(r=Math.abs(o))),{next:s,current:r}},moveActiveStepToTop:function(e,t){if(E.options.moveActiveStepToTop===!0){var n=E.$steps[E.prevStepId-1],i=E.noOfSteps-1;n.style.zIndex=1,e.style.zIndex=i,t.style.zIndex=E.noOfSteps}return null},manageNavigationSkip:function(e,t){if(E.isFallbackMode!==!0){var n,i,a,o,r;if(E.ui.show(t,0),E.options.navigationSkip===!0){if(E.navigationSkipThresholdActive=!0,0!==E.phasesAnimating&&(clearTimeout(E.phaseThresholdTimer),clearTimeout(E.nextPhaseStartedTimer),E.options.fadeStepWhenSkipped===!0))for(n=1;n<=E.noOfSteps;n++)i=E.stepProperties[n],i.isActive===!0&&n!==e&&(a=E.$steps[n-1],o=n,r={},r.id=o,r.element=a,E.phasesSkipped.push(r),E.animation.stepSkipped(a));E.navigationSkipThresholdTimer=setTimeout(function(){E.navigationSkipThresholdActive=!1},E.options.navigationSkipThreshold)}}},stepSkipped:function(e){E.ui.hide(e,E.options.fadeStepTime,function(){})},changeStep:function(e){var t="seq-step"+e;if(void 0!==E.currentStepId){var n="seq-step"+E.currentStepId;P(E.$container,t),w(E.$container,n)}else P(E.$container,t)},reverseProperties:function(e,t,n,i,a){var o,r,s,l,u,p,c,h=this,f=e.children,m=f.length,g=e.timings,y="",S="",P=[],w=[];for(r=0;r=t?e:t;break;default:i=e>=t+n?e-n:t}return i},currentPhaseStarted:function(e){E.phasesAnimating++,E.currentPhaseStarted(e,E)},currentPhaseEnded:function(e){E.currentPhaseEnded(e,E)},nextPhaseStarted:function(e,t){E.phasesAnimating++,void 0===t&&E.hashTags.update(),E.pagination.update(),E.nextPhaseStarted(e,E)},nextPhaseEnded:function(e){E.nextPhaseEnded(e,E)},phaseEnded:function(e,t,n,i){var a;a=function(e){E.stepProperties[e].isActive=!1,E.phasesAnimating--,i(e)},"current"===t?E.currentPhaseEndedTimer=setTimeout(function(){a(e)},n):E.nextPhaseEndedTimer=setTimeout(function(){a(e)},n)},stepEnded:function(e){E.isAnimating=!1,E.isAutoPlaying=!1,E.options.autoPlay===!0&&E.autoPlay.start(!0,!0),E.animationEnded(e,E)},reversePhase:function(e){var t={"seq-out":"seq-in","seq-in":"seq-out"};return t[e]},domDelay:function(e){setTimeout(function(){e()},l)},reverseTimingFunction:function(e){if(""===e||void 0===e)return e;var t,n,i,a,o={linear:"cubic-bezier(0.0,0.0,1.0,1.0)",ease:"cubic-bezier(0.25, 0.1, 0.25, 1.0)","ease-in":"cubic-bezier(0.42, 0.0, 1.0, 1.0)","ease-in-out":"cubic-bezier(0.42, 0.0, 0.58, 1.0)","ease-out":"cubic-bezier(0.0, 0.0, 0.58, 1.0)"};for(e.indexOf("cubic-bezier")<0&&(e=e.split(",")[0],e=o[e]),t=e.replace("cubic-bezier(","").replace(")","").split(","),n=t.length,a=0;a-1&&(e=t+1))}return e},hasCorrespondingStep:function(e){var t=-1,n=E.stepHashTags.indexOf(e);return n>-1&&(t=n),t},getStepHashTags:function(){var e,t,n=[];for(e=0;e=0;n--)e[n]===t&&e.splice(n,1)},setInterval(function(){var n=location.href;if(t!==n){var i=t;t=n;for(var a=0;aSequence.js Preloading IndicatorThree orange dots increasing in size from left to right',fallbackHtml:'
',defaultStyles:"@"+p.animation[d.prefixed("animation")]+"keyframes seq-preloader {50% {opacity: 1;}100% {opacity: 0;}}.seq-preloader {background: white;visibility: visible;opacity: 1;position: absolute;z-index: 9999;height: 100%;width: 100%;top: 0;left: 0;right: 0;bottom: 0;} .seq-preloader.seq-preloaded {opacity: 0;visibility: hidden;"+d.prefixed("transition")+": visibility 0s .5s, opacity .5s;}.seq-preload-indicator {overflow: visible;position: relative;top: 50%;left: 50%;-webkit-transform: translate(-50%, -50%);transform: translate(-50%, -50%);}.seq-preload-circle {display: inline-block;height: 12px;width: 12px;fill: #F96D38;opacity: 0;"+p.animation[d.prefixed("animation")]+"animation: seq-preloader 1.25s infinite;}.seq-preload-circle-2 {"+p.animation[d.prefixed("animation")]+"animation-delay: .15s;}.seq-preload-circle-3 {"+p.animation[d.prefixed("animation")]+"animation-delay: .3s;}.seq-preload-indicator-fallback{width: 42px;margin-left: -21px;overflow: visible;}.seq-preload-indicator-fallback .seq-preload-circle {width: 8px; height:8px;background-color: #F96D38;border-radius: 100%; opacity: 1;display: inline-block; vertical-align: middle;}.seq-preload-indicator-fallback .seq-preload-circle-2{margin-left: 3px; margin-right: 3px; width: 12px; height: 12px;}.seq-preload-indicator-fallback .seq-preload-circle-3{width: 16px; height: 16px;}",init:function(t){if(E.options.preloader!==!1){var n,i,a,o,r,s,l=this;return P(E.$container,"seq-preloading"),E.$preloader=E.ui.getElements("preloader",E.options.preloader),l.append(),l.addStyles(),l.toggleStepsVisibility("hide"),n=l.getImagesToPreload(E.options.preloadTheseSteps),i=l.getImagesToPreload(E.options.preloadTheseImages,!0),a=n.concat(i),o=e(a),o.on("always",function(e){l.complete(t)}),r=1,o.on("progress",function(e,t){s=t.isLoaded?"loaded":"broken",E.preloadProgress(s,t.img.src,r++,a.length,E)}),!0}return!1},complete:function(e){E.preloaded(E),E.options.pausePreloader!==!0&&(this.toggleStepsVisibility("show"),w(E.$container,"seq-preloading"),P(E.$container,"seq-preloaded"),P(E.$preloader[0],"seq-preloaded"),void 0!==this.preloadIndicatorTimer&&clearInterval(this.preloadIndicatorTimer),d.prefixed("animation")!==!1&&d.svg!==!1||(E.$preloader[0].style.display="none"),void 0!==e&&e())},addStyles:function(){if(E.options.preloader===!0){var e=document.head||document.getElementsByTagName("head")[0];if(this.styleElement=document.createElement("style"),this.styleElement.type="text/css",this.styleElement.styleSheet?this.styleElement.styleSheet.cssText=this.defaultStyles:this.styleElement.appendChild(document.createTextNode(this.defaultStyles)),e.appendChild(this.styleElement),d.prefixed("animation")===!1||d.svg===!1){var t=E.$preloader[0].firstChild,n=function(){t.style.visibility="hidden",preloadFlashTime=1e3,setTimeout(function(){t.style.visibility="visible"},500)};n(),this.preloadIndicatorTimer=setInterval(function(){n()},1e3)}return!0}return!1},removeStyles:function(){this.styleElement.parentNode.removeChild(this.styleElement)},getImagesToPreload:function(e,t){var n=[];if(f(e)===!0){var i,a,o,r,s,l,u,p,d=e.length;if(t!==!0)for(i=0;i0&&void 0!==document.querySelectorAll){var i=E.manageEvents.list.hammer[0].handler;E.hammerTime.off("swipe",[i])}break;default:for(var a=0;a0&&t<=E.noOfSteps&&E.options.numericKeysGoToSteps&&E.goTo(t),e.keyCode){case 37:E.options.keyEvents.left(E);break;case 39:E.options.keyEvents.right(E)}});E.manageEvents.list.keyup.push({element:document,handler:e})},resizeThrottle:function(){function e(){setTimeout(function(){E.canvas.getTransformProperties(),E.propertySupport.transitions===!0&&E.canvas.move(E.currentStepId,!1)},500),E.throttledResize(E)}var t,n;n=g(window,"resize",function(n){clearTimeout(t),t=setTimeout(e,u)}),E.manageEvents.list.resize.push({element:window,handler:n})},pageVisibility:function(){var e=g(document,h,function(){document[c]?E.autoPlay.pause():E.autoPlay.unpause()},!1);E.manageEvents.list[h].push({element:document,handler:e})}}},E.init=function(t){var n,i,a,r;E.options=m(s,o),E.isAnimating=!1,E.isReady=!1,E.$container=t,E.$screen=E.$container.querySelectorAll(".seq-screen")[0],E.$canvas=E.$container.querySelectorAll(".seq-canvas")[0],E.$steps=E.canvas.getSteps(E.$canvas),E.noOfSteps=E.$steps.length,E.phasesAnimating=0,E.phasesSkipped=[],k(E.$container,d),n=E.options.startingStepId,P(E.$container,"seq-active"),E.propertySupport=E.animation.getPropertySupport(),E.isFallbackMode=E.animation.requiresFallbackMode(E.propertySupport),E.canvas.init(n),E.canvas.removeNoJsClass(E),E.manageEvents.init(),E.autoPlay.init(),E.firstRun=!0,n=E.hashTags.init(n),1===E.options.autoPlayDirection?(a=n-1,E.prevStepId=a<1?E.noOfSteps:a):(a=n+1,E.prevStepId=a>E.noOfSteps?1:a),E.currentStepId=E.prevStepId,i=E.prevStepId,E.animationFallback.setupCanvas(n),r=function(){E.animation.domDelay(function(){E.animation.domDelay(function(){E.animation.resetInheritedSpeed(i)}),E.isReady=!0,E.ready(E),E.goTo(n,E.options.autoPlayDirection,!0)})},E.options.preloader!==!1&&void 0!==document.querySelectorAll&&"function"==typeof e?E.preload.init(function(){r()}):r()},E.destroy=function(){var e,t,n;for(E.autoPlay.stop(),clearTimeout(E.autoPlayTimer),clearTimeout(E.phaseThresholdTimer),clearTimeout(E.stepEndedTimer),clearTimeout(E.currentPhaseEndedTimer),clearTimeout(E.nextPhaseStartedTimer),clearTimeout(E.nextPhaseEndedTimer),clearTimeout(E.fadeStepTimer),clearTimeout(E.hideTimer),clearTimeout(E.navigationSkipThresholdTimer),E.manageEvents.removeAll(E.manageEvents.list),w(E.$pagination.currentLinks,"seq-current"),w(E.$container,"seq-step"+E.currentStepId),w(E.$container,"seq-active"),E.$container.removeAttribute("style"),void 0!==E.$screen&&E.$screen.removeAttribute("style"),E.$canvas.removeAttribute("style"),e=0;eE.noOfSteps&&E.options.cycle===!1)&&(e>E.noOfSteps&&(e=1),E.goTo(e),e)},E.prev=function(){var e,t=E.currentStepId-1;return!(t<1&&E.options.cycle===!1)&&(t<1&&(t=E.noOfSteps), E.options.reverseWhenNavigatingBackwards===!0&&(e=-1),E.goTo(t,e),t)},E.toggleAutoPlay=function(e){return E.isAutoPlaying===!1?E.start(e):E.stop(),E.isAutoPlaying},E.stop=function(){E.autoPlay.stop()},E.start=function(e){E.autoPlay.start(e)},E.goTo=function(e,t,n,i){if(t=E.animation.getDirection(e,t,E.currentStepId,E.noOfSteps,E.isFallbackMode,E.options.reverseWhenNavigatingBackwards,E.options.cycle),void 0===e||e<1||e>E.noOfSteps||e===E.currentStepId||E.options.navigationSkip===!1&&E.isAnimating===!0||E.options.navigationSkip===!0&&E.navigationSkipThresholdActive===!0&&void 0===i||E.isFallbackMode===!0&&E.isAnimating===!0&&void 0===i||E.options.preventReverseSkipping===!0&&E.direction!==t&&E.isAnimating===!0)return!1;var a,o;return clearTimeout(E.autoPlayTimer),E.direction=t,1===t?w(E.$container,"seq-reversed"):P(E.$container,"seq-reversed"),a=E.$steps[E.currentStepId-1],o=E.$steps[e-1],E.animation.moveActiveStepToTop(a,o),E.animation.changeStep(e),E.isFallbackMode===!1?(E.animation.resetInheritedSpeed(e),(E.firstRun===!1||E.firstRun===!0&&E.options.startingStepAnimatesIn===!0)&&E.animationStarted(e,E),E.canvas.move(e,!0),E.animation.manageNavigationSkip(e,o),1===t?E.animation.forward(e,a,o,n,i):E.animation.reverse(e,a,o,n,i)):E.animationFallback.goTo(e,E.currentStepId,a,e,o,t,i),!0},E.started=function(e){},E.stopped=function(e){},E.animationStarted=function(e,t){},E.animationEnded=function(e,t){},E.currentPhaseStarted=function(e,t){},E.currentPhaseEnded=function(e,t){},E.nextPhaseStarted=function(e,t){},E.nextPhaseEnded=function(e,t){},E.throttledResize=function(e){},E.preloaded=function(e){},E.preloadProgress=function(e,t,n,i,a){},E.ready=function(e){},E.destroyed=function(e){},E.utils={addClass:P,removeClass:w,addEvent:g,removeEvent:y},E.init(a),n.push(E),E};return a}if("function"==typeof define&&define.amd)define(["imagesLoaded","Hammer"],defineSequence);else{Hammer="function"!=typeof Hammer?null:Hammer,imagesLoaded="function"!=typeof imagesLoaded?null:imagesLoaded;var sequence=defineSequence(imagesLoaded,Hammer)}