/*! * glide.js * version: 1.0.6 * simple, lightweight and fast jquery slider * author: @jedrzejchalubek * site: http://jedrzejchalubek.com/ * licensed under the mit license */ !function(a,b,c,d){function e(b,c){var d=this;return this.options=a.extend({},g,c),this.currentslide=0,this.csssupport=this.css.issupported("transition")&&this.css.issupported("transform")?!0:!1,this.offset=this.options.circular?2:0,this.options.beforeinit.call(this),this.parent=b,this.init(),this.play(),this.options.afterinit.call(this),{current:function(){return-d.currentslide+1},reinit:function(){d.init()},play:function(){d.play()},pause:function(){d.pause()},next:function(a){d.slide(1,!1,a)},prev:function(a){d.slide(-1,!1,a)},jump:function(a,b){d.slide(a-1,!0,b)},nav:function(a){d.navigation.wrapper&&d.navigation.wrapper.remove(),d.options.navigation=a?a:d.options.navigation,d.navigation()},arrows:function(a){d.arrows.wrapper&&d.arrows.wrapper.remove(),d.options.arrows=a?a:d.options.arrows,d.arrows()}}}var f="glide",g={autoplay:4e3,hoverpause:!0,circular:!0,animationduration:500,animationtimingfunc:"cubic-bezier(0.165, 0.840, 0.440, 1.000)",arrows:!0,arrowswrapperclass:"slider-arrows",arrowmainclass:"slider-arrow",arrowrightclass:"slider-arrow--right",arrowrighttext:"next",arrowleftclass:"slider-arrow--left",arrowlefttext:"prev",navigation:!0,navigationcenter:!0,navigationclass:"slider-nav",navigationitemclass:"slider-nav__item",navigationcurrentitemclass:"slider-nav__item--current",keyboard:!0,touchdistance:60,beforeinit:function(){},afterinit:function(){},beforetransition:function(){},aftertransition:function(){}};e.prototype.build=function(){this.bindings(),this.slides.length>1&&(this.options.circular&&this.circular(),this.options.arrows&&this.arrows(),this.options.navigation&&this.navigation()),this.events()},e.prototype.circular=function(){this.firstclone=this.slides.filter(":first-child").clone().width(this.slides.spread),this.lastclone=this.slides.filter(":last-child").clone().width(this.slides.spread),this.wrapper.append(this.firstclone).prepend(this.lastclone).width(this.parent.width()*(this.slides.length+2)).trigger("cleartransition").trigger("settranslate",[-this.slides.spread])},e.prototype.navigation=function(){this.navigation.items={},this.navigation.wrapper=a("
",{"class":this.options.navigationclass}).appendto(this.options.navigation===!0?this.parent:this.options.navigation);for(var b=0;b",{href:"#","class":this.options.navigationitemclass,"data-distance":b}).appendto(this.navigation.wrapper);this.navigation.items[0].addclass(this.options.navigationcurrentitemclass),this.options.navigationcenter&&this.navigation.wrapper.css({left:"50%",width:this.navigation.wrapper.children().outerwidth(!0)*this.navigation.wrapper.children().length,"margin-left":-(this.navigation.wrapper.outerwidth(!0)/2)})},e.prototype.arrows=function(){this.arrows.wrapper=a("
",{"class":this.options.arrowswrapperclass}).appendto(this.options.arrows===!0?this.parent:this.options.arrows),this.arrows.right=a("",{href:"#","class":this.options.arrowmainclass+" "+this.options.arrowrightclass,"data-distance":"1",html:this.options.arrowrighttext}).appendto(this.arrows.wrapper),this.arrows.left=a("",{href:"#","class":this.options.arrowmainclass+" "+this.options.arrowleftclass,"data-distance":"-1",html:this.options.arrowlefttext}).appendto(this.arrows.wrapper)},e.prototype.bindings=function(){var b=this,c=this.options,d=this.css.getprefix();this.wrapper.bind({settransition:function(){a(this).css(d+"transition",d+"transform "+c.animationduration+"ms "+c.animationtimingfunc)},cleartransition:function(){a(this).css(d+"transition","none")},settranslate:function(c,e){b.csssupport?a(this).css(d+"transform","translate3d("+e+"px, 0px, 0px)"):a(this).css("margin-left",e)}})},e.prototype.events=function(){this.options.touchdistance&&this.parent.on({"touchstart mspointerdown":a.proxy(this.events.touchstart,this),"touchmove mspointermove":a.proxy(this.events.touchmove,this),"touchend mspointerup":a.proxy(this.events.touchend,this)}),this.arrows.wrapper&&a(this.arrows.wrapper).children().on("click touchstart",a.proxy(this.events.arrows,this)),this.navigation.wrapper&&a(this.navigation.wrapper).children().on("click touchstart",a.proxy(this.events.navigation,this)),this.options.keyboard&&a(c).on("keyup.glidekeyup",a.proxy(this.events.keyboard,this)),this.options.hoverpause&&this.parent.on("mouseover mouseout",a.proxy(this.events.hover,this)),a(b).on("resize",a.proxy(this.events.resize,this))},e.prototype.events.navigation=function(b){this.wrapper.attr("disabled")||(b.preventdefault(),this.slide(a(b.currenttarget).data("distance"),!0))},e.prototype.events.arrows=function(b){this.wrapper.attr("disabled")||(b.preventdefault(),this.slide(a(b.currenttarget).data("distance"),!1))},e.prototype.events.keyboard=function(a){this.wrapper.attr("disabled")||(39===a.keycode&&this.slide(1),37===a.keycode&&this.slide(-1))},e.prototype.events.hover=function(a){this.pause(),"mouseout"===a.type&&this.play()},e.prototype.events.resize=function(){this.dimensions(),this.slide(0)},e.prototype.disableevents=function(){this.wrapper.attr("disabled",!0)},e.prototype.enableevents=function(){this.wrapper.attr("disabled",!1)},e.prototype.events.touchstart=function(a){var b=a.originalevent.touches[0]||a.originalevent.changedtouches[0];this.events.touchstartx=b.pagex,this.events.touchstarty=b.pagey,this.events.touchsin=null},e.prototype.events.touchmove=function(a){var b=a.originalevent.touches[0]||a.originalevent.changedtouches[0],c=b.pagex-this.events.touchstartx,d=b.pagey-this.events.touchstarty,e=math.abs(c<<2),f=math.abs(d<<2),g=math.sqrt(e+f),h=math.sqrt(f);this.events.touchsin=math.asin(h/g),this.events.touchsin*(180/math.pi)<45&&a.preventdefault()},e.prototype.events.touchend=function(a){var b=a.originalevent.touches[0]||a.originalevent.changedtouches[0],c=b.pagex-this.events.touchstartx;c>this.options.touchdistance&&this.events.touchsin*(180/math.pi)<45?this.slide(-1):c<-this.options.touchdistance&&this.events.touchsin*(180/math.pi)<45&&this.slide(1)},e.prototype.slide=function(b,c,d){this.pause(),this.options.beforetransition.call(this);var e=this,f=c?0:this.currentslide,g=-(this.slides.length-1),h=!1,i=!1;0===f&&-1===b?(h=!0,f=g):f===g&&1===b?(i=!0,f=0):f+=-b;var j=this.slides.spread*f;this.options.circular&&(j-=this.slides.spread,(i||h)&&this.disableevents(),i&&(j=this.slides.spread*(g-2)),h&&(j=0)),this.csssupport?this.wrapper.trigger("settransition").trigger("settranslate",[j]):this.wrapper.stop().animate({"margin-left":j},this.options.animationduration),this.options.circular&&((h||i)&&this.afteranimation(function(){e.wrapper.trigger("cleartransition"),e.enableevents()}),i&&this.afteranimation(function(){i=!1,e.wrapper.trigger("settranslate",[-e.slides.spread])}),h&&this.afteranimation(function(){h=!1,e.wrapper.trigger("settranslate",[e.slides.spread*(g-1)])})),this.options.navigation&&this.navigation.wrapper&&a("."+this.options.navigationclass,this.options.navigation===!0?this.parent:this.options.navigation).children().eq(-f).addclass(this.options.navigationcurrentitemclass).siblings().removeclass(this.options.navigationcurrentitemclass),this.currentslide=f,this.afteranimation(function(){e.options.aftertransition.call(e),"undefined"!==d&&"function"==typeof d&&d()}),this.play()},e.prototype.play=function(){var a=this;this.options.autoplay&&(this.auto=setinterval(function(){a.slide(1,!1)},this.options.autoplay))},e.prototype.pause=function(){this.options.autoplay&&(this.auto=clearinterval(this.auto))},e.prototype.afteranimation=function(a){settimeout(function(){a()},this.options.animationduration+10)},e.prototype.dimensions=function(){this.slides.spread=this.parent.width(),this.wrapper.width(this.slides.spread*(this.slides.length+this.offset)),this.slides.add(this.firstclone).add(this.lastclone).width(this.slides.spread)},e.prototype.init=function(){this.wrapper=this.parent.children(),this.slides=this.wrapper.children(),this.dimensions(),this.build()},e.prototype.css={issupported:function(a){var e=!1,f="khtml ms o moz webkit".split(" "),g=c.createelement("div"),h=null;if(a=a.tolowercase(),g.style[a]!==d&&(e=!0),e===!1){h=a.charat(0).touppercase()+a.substr(1);for(var i=0;i