text: (function(a,b){'function'==typeof define&&define.amd?define([],b):'object'==typeof module&&module.exports?module.exports=b():a.HPS=b()})(this,function(){var a=function(b,c){'use strict';var f,g,i,j,d=Object.create(a.prototype),h=[],k=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||function(U){setTimeout(U,1e3/60)},l=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||window.oCancelAnimationFrame||function(U){clearTimeout(U)};if(d.options={sectionClass:'hps-section',scrollCallback:!1,touchMult:-2,firefoxMult:15,mouseMult:1,ease:0.1,controls:{append:!0,elementClass:'hps-controls',prevButtonClass:'hps-control-prev',nextButtonClass:'hps-control-next'}},c&&Object.keys(c).forEach(function(U){d.options[U]=c[U]}),b||(b='.hps-wrapper'),'string'==typeof b)var m=document.querySelector(b);else var m=b[0]||b;if(!(m&&'object'==typeof m))throw new Error('The wrapper you\'re trying to select don\'t exist.');else if(d.wrapper=m,0<m.children.length)d.sections=m.children;else throw new Error('Selected wrapper does not contain any child object.');var w,x,y,o=function(){h=[],f=window.innerWidth,g=window.innerHeight,r(document.querySelector('body'),{overflow:'hidden'}),r(document.querySelector('html'),{overflow:'hidden'}),r(d.wrapper,{width:f*d.sections.length});for(var U of d.sections)r(U,{float:'left'}),U.classList.add(d.options.sectionClass)},p=function(){j=document.createElement('div'),j.classList.add(d.options.controls.elementClass),j.style.cssText='position:fixed;top:0;left:0;z-index:999;';var U=document.createElement('button');U.classList.add(d.options.controls.prevButtonClass),U.style.cssText='font-size: 21px',U.innerText='Previous';var V=document.createElement('button');V.classList.add(d.options.controls.nextButtonClass),V.style.cssText='font-size: 21px',V.innerText='Next',j.appendChild(U),j.appendChild(V),document.querySelector('body').appendChild(j)},q=function(){if(0<h.length)for(var U in h)r(h[U].elem,h[U].styles,!1);for(var V of d.sections)V.classList.remove(d.options.sectionClass);h=[]},r=function(U,V,W=!0){if(W)var X={elem:U,styles:{transform:'',webkitTransform:'',mozTransform:'',msTransform:''}};for(var Y in V)'number'==typeof V[Y]&&(V[Y]+='px'),!W||(X.styles[Y]=U.style[Y]),U.style[Y]=V[Y];!W||h.push(X)},z=0,A=0,B=0,C='onwheel'in document,D='onmousewheel'in document,E='ontouchstart'in document,F=navigator.msMaxTouchPoints&&1<navigator.msMaxTouchPoints,G=!!window.navigator.msPointerEnabled,H='onkeydown'in document,I=-1<navigator.userAgent.indexOf('Firefox'),J={y:0,x:0,deltaX:0,deltaY:0,originalEvent:null},K=function(U){J.x+=J.deltaX,J.y+=J.deltaY,J.originalEvent=U,d.options.scrollCallback||('click'==U.type?A=-J.deltaX||J.deltaY:(A+=-J.deltaX||J.deltaY,A=Math.max(-1*(f*d.sections.length-f),A),A=Math.min(0,A)))},L=function(U){J.deltaX=U.wheelDeltaX||-1*U.deltaX,J.deltaY=U.wheelDeltaY||-1*U.deltaY,I&&1==U.deltaMode&&(J.deltaX*=d.options.firefoxMult,J.deltaY*=d.options.firefoxMult),J.deltaX*=d.options.mouseMult,J.deltaY*=d.options.mouseMult,K(U)},M=function(U){J.deltaX=U.wheelDeltaX?U.wheelDeltaX:0,J.deltaY=U.wheelDeltaY?U.wheelDeltaY:U.wheelDelta,K(U)},N=function(U){var V=U.targetTouches?U.targetTouches[0]:U;w=V.pageX,x=V.pageY},O=function(U){var V=U.targetTouches?U.targetTouches[0]:U;J.deltaX=(V.pageX-w)*d.options.touchMult,J.deltaY=(V.pageY-x)*d.options.touchMult,w=V.pageX,x=V.pageY,K(U)},P=function(U){document.querySelector('.'+d.options.controls.nextButtonClass).removeAttribute('disabled'),document.querySelector('.'+d.options.controls.prevButtonClass).removeAttribute('disabled'),B=Math.abs(Math.round(z/f)),-1<U.target.className.indexOf(d.options.controls.nextButtonClass)?(!!(B<d.sections.length-1)&&B++,B==d.sections.length-1&&U.target.setAttribute('disabled','true')):(!!(0<B)&&B--,0==B&&U.target.setAttribute('disabled','true')),J.deltaX=d.sections[B].offsetLeft,J.deltaY=-d.sections[B].offsetLeft,K(U)},Q=function(){C&&document.addEventListener('wheel',L),D&&document.addEventListener('mousewheel',M),E&&(document.addEventListener('touchstart',N),document.addEventListener('touchmove',O)),G&&F&&(y=document.body.style.msTouchAction,document.body.style.msTouchAction='none',document.addEventListener('MSPointerDown',N,!0),document.addEventListener('MSPointerMove',O,!0)),d.options.controls.append&&j.addEventListener('click',P)},R=function(){C&&document.removeEventListener('wheel',L),D&&document.removeEventListener('mousewheel',M),E&&(document.removeEventListener('touchstart',N),document.removeEventListener('touchmove',O)),G&&F&&(document.body.style.msTouchAction=y,document.removeEventListener('MSPointerDown',N,!0),document.removeEventListener('MSPointerMove',O,!0)),d.options.controls.append&&j.removeEventListener('click',P)},S=function(){i=k(S),z+=(A-z)*d.options.ease,(isNaN(z)||z>-d.options.ease)&&(z=0);var U='translateX('+z+'px) translateZ(0)',V=d.wrapper.style;V.transform=U,V.webkitTransform=U,V.mozTransform=U,V.msTransform=U},T=function(){i=k(T),d.options.scrollCallback(J)};return d.destroy=function(){l(i),R(),q(),j.remove()},function(){o(),d.options.controls.append&&p(),Q(),d.options.scrollCallback?T():S()}(),d};return a});
  