diff --git a/ideal-image-slider.js b/ideal-image-slider.js index 4bbaeec..f46925b 100644 --- a/ideal-image-slider.js +++ b/ideal-image-slider.js @@ -219,6 +219,7 @@ var IdealImageSlider = (function() { _removeClass(this._attributes.previousSlide, this.settings.classes.previousSlide); _removeClass(this._attributes.currentSlide, this.settings.classes.currentSlide); _removeClass(this._attributes.nextSlide, this.settings.classes.nextSlide); + this._attributes.currentSlide.setAttribute('aria-hidden', 'true'); var slides = this._attributes.slides, index = slides.indexOf(this._attributes.currentSlide); @@ -258,6 +259,7 @@ var IdealImageSlider = (function() { _addClass(this._attributes.previousSlide, this.settings.classes.previousSlide); _addClass(this._attributes.currentSlide, this.settings.classes.currentSlide); _addClass(this._attributes.nextSlide, this.settings.classes.nextSlide); + this._attributes.currentSlide.setAttribute('aria-hidden', 'false'); this.settings.afterChange.apply(this); } @@ -311,7 +313,6 @@ var IdealImageSlider = (function() { // Slider (container) element var sliderEl = document.querySelector(this.settings.selector); if(!sliderEl) return null; - sliderEl.setAttribute('role', 'listbox'); // Slides var origChildren = _toArray(sliderEl.children), @@ -362,7 +363,8 @@ var IdealImageSlider = (function() { if(slide.getAttribute('className')) _addClass(slideEl, slide.getAttribute('className')); if(slide.getAttribute('id')) slideEl.setAttribute('id', slide.id); if(slide.getAttribute('alt')) slideEl.innerHTML = slide.getAttribute('alt'); - slideEl.setAttribute('role', 'option'); + slideEl.setAttribute('role', 'tabpanel'); + slideEl.setAttribute('aria-hidden', 'true'); slideEl.style.cssText += '-webkit-transition-duration:'+ this.settings.transitionDuration +'ms;-moz-transition-duration:'+ this.settings.transitionDuration +'ms;-o-transition-duration:'+ this.settings.transitionDuration +'ms;transition-duration:'+ this.settings.transitionDuration +'ms;'; @@ -457,6 +459,9 @@ var IdealImageSlider = (function() { _addClass(this._attributes.currentSlide, this.settings.classes.currentSlide); _addClass(this._attributes.nextSlide, this.settings.classes.nextSlide); + // ARIA + this._attributes.currentSlide.setAttribute('aria-hidden', 'false'); + // Load first image _loadImg(this._attributes.currentSlide, (function(){ this.settings.onInit.apply(this); @@ -497,6 +502,7 @@ var IdealImageSlider = (function() { _removeClass(this._attributes.previousSlide, this.settings.classes.previousSlide); _removeClass(this._attributes.currentSlide, this.settings.classes.currentSlide); _removeClass(this._attributes.nextSlide, this.settings.classes.nextSlide); + this._attributes.currentSlide.setAttribute('aria-hidden', 'true'); var slides = this._attributes.slides, index = slides.indexOf(this._attributes.currentSlide); @@ -519,6 +525,7 @@ var IdealImageSlider = (function() { _addClass(this._attributes.previousSlide, this.settings.classes.previousSlide); _addClass(this._attributes.currentSlide, this.settings.classes.currentSlide); _addClass(this._attributes.nextSlide, this.settings.classes.nextSlide); + this._attributes.currentSlide.setAttribute('aria-hidden', 'false'); _addClass(this._attributes.container, this.settings.classes.directionPrevious); setTimeout(function(){ @@ -539,6 +546,7 @@ var IdealImageSlider = (function() { _removeClass(this._attributes.previousSlide, this.settings.classes.previousSlide); _removeClass(this._attributes.currentSlide, this.settings.classes.currentSlide); _removeClass(this._attributes.nextSlide, this.settings.classes.nextSlide); + this._attributes.currentSlide.setAttribute('aria-hidden', 'true'); var slides = this._attributes.slides, index = slides.indexOf(this._attributes.currentSlide); @@ -561,6 +569,7 @@ var IdealImageSlider = (function() { _addClass(this._attributes.previousSlide, this.settings.classes.previousSlide); _addClass(this._attributes.currentSlide, this.settings.classes.currentSlide); _addClass(this._attributes.nextSlide, this.settings.classes.nextSlide); + this._attributes.currentSlide.setAttribute('aria-hidden', 'false'); _addClass(this._attributes.container, this.settings.classes.directionNext); setTimeout(function(){ @@ -583,6 +592,7 @@ var IdealImageSlider = (function() { _removeClass(this._attributes.previousSlide, this.settings.classes.previousSlide); _removeClass(this._attributes.currentSlide, this.settings.classes.currentSlide); _removeClass(this._attributes.nextSlide, this.settings.classes.nextSlide); + this._attributes.currentSlide.setAttribute('aria-hidden', 'true'); index--; // Index should be 1-indexed var slides = this._attributes.slides; @@ -604,6 +614,7 @@ var IdealImageSlider = (function() { _addClass(this._attributes.previousSlide, this.settings.classes.previousSlide); _addClass(this._attributes.currentSlide, this.settings.classes.currentSlide); _addClass(this._attributes.nextSlide, this.settings.classes.nextSlide); + this._attributes.currentSlide.setAttribute('aria-hidden', 'false'); if(this.settings.transitionDuration){ _addClass(this._attributes.container, this.settings.classes.animating); diff --git a/ideal-image-slider.min.js b/ideal-image-slider.min.js index 1f0a1b9..b7e9296 100644 --- a/ideal-image-slider.min.js +++ b/ideal-image-slider.min.js @@ -1,2 +1,2 @@ /*! Ideal Image Slider v1.0.2 */ -var IdealImageSlider=function(){"use strict";var a=function(a){a=a||{};for(var b=1;b1?!0:window.matchMedia&&window.matchMedia(a).matches?!0:!1},h=function(a,b,c){a.style.webkitTransitionDuration=a.style.MozTransitionDuration=a.style.msTransitionDuration=a.style.OTransitionDuration=a.style.transitionDuration=c+"ms",a.style.webkitTransform=a.style.MozTransform=a.style.msTransform=a.style.OTransform="translateX("+b+"px)"},i=function(a){a.style.removeProperty("-webkit-transition-duration"),a.style.removeProperty("-moz-transition-duration"),a.style.removeProperty("-ms-transition-duration"),a.style.removeProperty("-o-transition-duration"),a.style.removeProperty("transition-duration"),a.style.removeProperty("-webkit-transform"),a.style.removeProperty("-moz-transform"),a.style.removeProperty("-ms-transform"),a.style.removeProperty("-0-transform"),a.style.removeProperty("transform")},j={vars:{start:{},delta:{},isScrolling:void 0,direction:null},start:function(a){if(!b(this._attributes.container,this.settings.classes.animating)){var d=a.touches[0];j.vars.start={x:d.pageX,y:d.pageY,time:+new Date},j.vars.delta={},j.vars.isScrolling=void 0,j.vars.direction=null,this.stop(),this.settings.beforeChange.apply(this),c(this._attributes.container,this.settings.classes.touching)}},move:function(a){if(!b(this._attributes.container,this.settings.classes.animating)&&!(a.touches.length>1||a.scale&&1!==a.scale)){var c=a.touches[0];j.vars.delta={x:c.pageX-j.vars.start.x,y:c.pageY-j.vars.start.y},"undefined"==typeof j.vars.isScrolling&&(j.vars.isScrolling=!!(j.vars.isScrolling||Math.abs(j.vars.delta.x)20||Math.abs(j.vars.delta.x)>this._attributes.currentSlide.offsetWidth/2,f=j.vars.delta.x<0?"next":"previous",g=this.settings.transitionDuration?this.settings.transitionDuration/2:0;j.vars.isScrolling||(e?(j.vars.direction=f,"next"==j.vars.direction?(h(this._attributes.currentSlide,-this._attributes.currentSlide.offsetWidth,g),h(this._attributes.nextSlide,0,g)):(h(this._attributes.previousSlide,0,g),h(this._attributes.currentSlide,this._attributes.currentSlide.offsetWidth,g)),setTimeout(j.transitionEnd.bind(this),g)):"next"==f?(h(this._attributes.currentSlide,0,g),h(this._attributes.nextSlide,this._attributes.currentSlide.offsetWidth,g)):(h(this._attributes.previousSlide,-this._attributes.previousSlide.offsetWidth,g),h(this._attributes.currentSlide,0,g)),g&&(c(this._attributes.container,this.settings.classes.animating),setTimeout(function(){d(this._attributes.container,this.settings.classes.animating)}.bind(this),g)))}},transitionEnd:function(){if(j.vars.direction){i(this._attributes.previousSlide),i(this._attributes.currentSlide),i(this._attributes.nextSlide),d(this._attributes.container,this.settings.classes.touching),d(this._attributes.previousSlide,this.settings.classes.previousSlide),d(this._attributes.currentSlide,this.settings.classes.currentSlide),d(this._attributes.nextSlide,this.settings.classes.nextSlide);var a=this._attributes.slides,b=a.indexOf(this._attributes.currentSlide);"next"==j.vars.direction?(this._attributes.previousSlide=this._attributes.currentSlide,this._attributes.currentSlide=a[b+1],this._attributes.nextSlide=a[b+2],"undefined"==typeof this._attributes.currentSlide&&"undefined"==typeof this._attributes.nextSlide?(this._attributes.currentSlide=a[0],this._attributes.nextSlide=a[1]):"undefined"==typeof this._attributes.nextSlide&&(this._attributes.nextSlide=a[0]),f(this._attributes.nextSlide)):(this._attributes.nextSlide=this._attributes.currentSlide,this._attributes.previousSlide=a[b-2],this._attributes.currentSlide=a[b-1],"undefined"==typeof this._attributes.currentSlide&&"undefined"==typeof this._attributes.previousSlide?(this._attributes.currentSlide=a[a.length-1],this._attributes.previousSlide=a[a.length-2]):"undefined"==typeof this._attributes.previousSlide&&(this._attributes.previousSlide=a[a.length-1]),f(this._attributes.previousSlide)),c(this._attributes.previousSlide,this.settings.classes.previousSlide),c(this._attributes.currentSlide,this.settings.classes.currentSlide),c(this._attributes.nextSlide,this.settings.classes.nextSlide),this.settings.afterChange.apply(this)}}},k=function(d){this.settings={selector:"",height:400,interval:4e3,transitionDuration:700,effect:"slide",disableNav:!1,keyboardNav:!0,previousNavSelector:"",nextNavSelector:"",classes:{container:"ideal-image-slider",slide:"iis-slide",previousSlide:"iis-previous-slide",currentSlide:"iis-current-slide",nextSlide:"iis-next-slide",previousNav:"iis-previous-nav",nextNav:"iis-next-nav",animating:"iis-is-animating",touching:"iis-is-touching",directionPrevious:"iis-direction-previous",directionNext:"iis-direction-next"},onInit:function(){},onStart:function(){},onStop:function(){},onDestroy:function(){},beforeChange:function(){},afterChange:function(){}},"string"==typeof d?this.settings.selector=d:"object"==typeof d&&a(this.settings,d);var h=document.querySelector(this.settings.selector);if(!h)return null;h.setAttribute("role","listbox");var i=e(h.children),k=[];h.innerHTML="",Array.prototype.forEach.call(i,function(b){if(b instanceof HTMLImageElement||b instanceof HTMLAnchorElement){var d=document.createElement("a"),e="",f="";if(b instanceof HTMLAnchorElement){e=b.getAttribute("href"),f=b.getAttribute("target");var i=b.querySelector("img");if(null===i)return;b=i}"undefined"!=typeof b.dataset?(a(d.dataset,b.dataset),d.dataset.src=b.dataset.src?b.dataset.src:b.src,g()&&b.dataset["src-2x"]&&(d.dataset.src=b.dataset["src-2x"])):b.getAttribute("data-src")?d.setAttribute("data-src",b.getAttribute("data-src")):d.setAttribute("data-src",b.getAttribute("src")),e&&d.setAttribute("href",e),f&&d.setAttribute("target",f),b.getAttribute("className")&&c(d,b.getAttribute("className")),b.getAttribute("id")&&d.setAttribute("id",b.id),b.getAttribute("alt")&&(d.innerHTML=b.getAttribute("alt")),d.setAttribute("role","option"),d.style.cssText+="-webkit-transition-duration:"+this.settings.transitionDuration+"ms;-moz-transition-duration:"+this.settings.transitionDuration+"ms;-o-transition-duration:"+this.settings.transitionDuration+"ms;transition-duration:"+this.settings.transitionDuration+"ms;",h.appendChild(d),k.push(d)}}.bind(this));var l=k;if(l.length<=1)return null;if(!this.settings.disableNav){var m,n;this.settings.previousNavSelector?m=document.querySelector(this.settings.previousNavSelector):(m=document.createElement("a"),h.appendChild(m)),this.settings.nextNavSelector?n=document.querySelector(this.settings.nextNavSelector):(n=document.createElement("a"),h.appendChild(n)),c(m,this.settings.classes.previousNav),c(n,this.settings.classes.nextNav),m.addEventListener("click",function(){return b(this._attributes.container,this.settings.classes.animating)?!1:(this.stop(),void this.previousSlide())}.bind(this)),n.addEventListener("click",function(){return b(this._attributes.container,this.settings.classes.animating)?!1:(this.stop(),void this.nextSlide())}.bind(this)),("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)&&(this.settings.effect="touch",m.style.display="none",n.style.display="none",h.addEventListener("touchstart",j.start.bind(this),!1),h.addEventListener("touchmove",j.move.bind(this),!1),h.addEventListener("touchend",j.end.bind(this),!1)),this.settings.keyboardNav&&document.addEventListener("keyup",function(a){a=a||window.event;var c="number"==typeof a.which?a.which:a.keyCode;if(37==c){if(b(this._attributes.container,this.settings.classes.animating))return!1;this.stop(),this.previousSlide()}else if(39==c){if(b(this._attributes.container,this.settings.classes.animating))return!1;this.stop(),this.nextSlide()}}.bind(this))}this._attributes={container:h,slides:l,previousSlide:"undefined"!=typeof l[l.length-1]?l[l.length-1]:l[0],currentSlide:l[0],nextSlide:"undefined"!=typeof l[1]?l[1]:l[0],timerId:0,origChildren:i},this.settings.height&&(this._attributes.container.style.height=this.settings.height+"px"),c(h,this.settings.classes.container),c(h,"iis-effect-"+this.settings.effect),Array.prototype.forEach.call(this._attributes.slides,function(a){c(a,this.settings.classes.slide)}.bind(this)),c(this._attributes.previousSlide,this.settings.classes.previousSlide),c(this._attributes.currentSlide,this.settings.classes.currentSlide),c(this._attributes.nextSlide,this.settings.classes.nextSlide),f(this._attributes.currentSlide,function(){this.settings.onInit.apply(this)}.bind(this)),f(this._attributes.previousSlide),f(this._attributes.nextSlide)};return k.prototype.get=function(a){return this._attributes.hasOwnProperty(a)?this._attributes[a]:void 0},k.prototype.set=function(a,b){return this._attributes[a]=b},k.prototype.start=function(){this._attributes.timerId=setInterval(this.nextSlide.bind(this),this.settings.interval),this.settings.onStart.apply(this),window.onblur=function(){this.stop()}.bind(this)},k.prototype.stop=function(){clearInterval(this._attributes.timerId),this._attributes.timerId=0,this.settings.onStop.apply(this)},k.prototype.previousSlide=function(){this.settings.beforeChange.apply(this),d(this._attributes.previousSlide,this.settings.classes.previousSlide),d(this._attributes.currentSlide,this.settings.classes.currentSlide),d(this._attributes.nextSlide,this.settings.classes.nextSlide);var a=this._attributes.slides,b=a.indexOf(this._attributes.currentSlide);this._attributes.nextSlide=this._attributes.currentSlide,this._attributes.previousSlide=a[b-2],this._attributes.currentSlide=a[b-1],"undefined"==typeof this._attributes.currentSlide&&"undefined"==typeof this._attributes.previousSlide?(this._attributes.currentSlide=a[a.length-1],this._attributes.previousSlide=a[a.length-2]):"undefined"==typeof this._attributes.previousSlide&&(this._attributes.previousSlide=a[a.length-1]),f(this._attributes.previousSlide),c(this._attributes.previousSlide,this.settings.classes.previousSlide),c(this._attributes.currentSlide,this.settings.classes.currentSlide),c(this._attributes.nextSlide,this.settings.classes.nextSlide),c(this._attributes.container,this.settings.classes.directionPrevious),setTimeout(function(){d(this._attributes.container,this.settings.classes.directionPrevious)}.bind(this),this.settings.transitionDuration),this.settings.transitionDuration&&(c(this._attributes.container,this.settings.classes.animating),setTimeout(function(){d(this._attributes.container,this.settings.classes.animating)}.bind(this),this.settings.transitionDuration)),this.settings.afterChange.apply(this)},k.prototype.nextSlide=function(){this.settings.beforeChange.apply(this),d(this._attributes.previousSlide,this.settings.classes.previousSlide),d(this._attributes.currentSlide,this.settings.classes.currentSlide),d(this._attributes.nextSlide,this.settings.classes.nextSlide);var a=this._attributes.slides,b=a.indexOf(this._attributes.currentSlide);this._attributes.previousSlide=this._attributes.currentSlide,this._attributes.currentSlide=a[b+1],this._attributes.nextSlide=a[b+2],"undefined"==typeof this._attributes.currentSlide&&"undefined"==typeof this._attributes.nextSlide?(this._attributes.currentSlide=a[0],this._attributes.nextSlide=a[1]):"undefined"==typeof this._attributes.nextSlide&&(this._attributes.nextSlide=a[0]),f(this._attributes.nextSlide),c(this._attributes.previousSlide,this.settings.classes.previousSlide),c(this._attributes.currentSlide,this.settings.classes.currentSlide),c(this._attributes.nextSlide,this.settings.classes.nextSlide),c(this._attributes.container,this.settings.classes.directionNext),setTimeout(function(){d(this._attributes.container,this.settings.classes.directionNext)}.bind(this),this.settings.transitionDuration),this.settings.transitionDuration&&(c(this._attributes.container,this.settings.classes.animating),setTimeout(function(){d(this._attributes.container,this.settings.classes.animating)}.bind(this),this.settings.transitionDuration)),this.settings.afterChange.apply(this)},k.prototype.gotoSlide=function(a){this.settings.beforeChange.apply(this),this.stop(),d(this._attributes.previousSlide,this.settings.classes.previousSlide),d(this._attributes.currentSlide,this.settings.classes.currentSlide),d(this._attributes.nextSlide,this.settings.classes.nextSlide),a--;var b=this._attributes.slides;this._attributes.previousSlide=b[a-1],this._attributes.currentSlide=b[a],this._attributes.nextSlide=b[a+1],"undefined"==typeof this._attributes.previousSlide&&(this._attributes.previousSlide=b[b.length-1]),"undefined"==typeof this._attributes.nextSlide&&(this._attributes.nextSlide=b[0]),f(this._attributes.previousSlide),f(this._attributes.currentSlide),f(this._attributes.nextSlide),c(this._attributes.previousSlide,this.settings.classes.previousSlide),c(this._attributes.currentSlide,this.settings.classes.currentSlide),c(this._attributes.nextSlide,this.settings.classes.nextSlide),this.settings.transitionDuration&&(c(this._attributes.container,this.settings.classes.animating),setTimeout(function(){d(this._attributes.container,this.settings.classes.animating)}.bind(this),this.settings.transitionDuration)),this.settings.afterChange.apply(this)},k.prototype.destroy=function(){clearInterval(this._attributes.timerId),this._attributes.timerId=0,this._attributes.container.innerHTML="",Array.prototype.forEach.call(this._attributes.origChildren,function(a){this._attributes.container.appendChild(a)}.bind(this)),d(this._attributes.container,this.settings.classes.container),d(this._attributes.container,"iis-effect-"+this.settings.effect),this._attributes.container.style.height="",this.settings.onDestroy.apply(this)},{Slider:k}}(); \ No newline at end of file +var IdealImageSlider=function(){"use strict";var a=function(a){a=a||{};for(var b=1;b1?!0:window.matchMedia&&window.matchMedia(a).matches?!0:!1},h=function(a,b,c){a.style.webkitTransitionDuration=a.style.MozTransitionDuration=a.style.msTransitionDuration=a.style.OTransitionDuration=a.style.transitionDuration=c+"ms",a.style.webkitTransform=a.style.MozTransform=a.style.msTransform=a.style.OTransform="translateX("+b+"px)"},i=function(a){a.style.removeProperty("-webkit-transition-duration"),a.style.removeProperty("-moz-transition-duration"),a.style.removeProperty("-ms-transition-duration"),a.style.removeProperty("-o-transition-duration"),a.style.removeProperty("transition-duration"),a.style.removeProperty("-webkit-transform"),a.style.removeProperty("-moz-transform"),a.style.removeProperty("-ms-transform"),a.style.removeProperty("-0-transform"),a.style.removeProperty("transform")},j={vars:{start:{},delta:{},isScrolling:void 0,direction:null},start:function(a){if(!b(this._attributes.container,this.settings.classes.animating)){var d=a.touches[0];j.vars.start={x:d.pageX,y:d.pageY,time:+new Date},j.vars.delta={},j.vars.isScrolling=void 0,j.vars.direction=null,this.stop(),this.settings.beforeChange.apply(this),c(this._attributes.container,this.settings.classes.touching)}},move:function(a){if(!b(this._attributes.container,this.settings.classes.animating)&&!(a.touches.length>1||a.scale&&1!==a.scale)){var c=a.touches[0];j.vars.delta={x:c.pageX-j.vars.start.x,y:c.pageY-j.vars.start.y},"undefined"==typeof j.vars.isScrolling&&(j.vars.isScrolling=!!(j.vars.isScrolling||Math.abs(j.vars.delta.x)20||Math.abs(j.vars.delta.x)>this._attributes.currentSlide.offsetWidth/2,f=j.vars.delta.x<0?"next":"previous",g=this.settings.transitionDuration?this.settings.transitionDuration/2:0;j.vars.isScrolling||(e?(j.vars.direction=f,"next"==j.vars.direction?(h(this._attributes.currentSlide,-this._attributes.currentSlide.offsetWidth,g),h(this._attributes.nextSlide,0,g)):(h(this._attributes.previousSlide,0,g),h(this._attributes.currentSlide,this._attributes.currentSlide.offsetWidth,g)),setTimeout(j.transitionEnd.bind(this),g)):"next"==f?(h(this._attributes.currentSlide,0,g),h(this._attributes.nextSlide,this._attributes.currentSlide.offsetWidth,g)):(h(this._attributes.previousSlide,-this._attributes.previousSlide.offsetWidth,g),h(this._attributes.currentSlide,0,g)),g&&(c(this._attributes.container,this.settings.classes.animating),setTimeout(function(){d(this._attributes.container,this.settings.classes.animating)}.bind(this),g)))}},transitionEnd:function(){if(j.vars.direction){i(this._attributes.previousSlide),i(this._attributes.currentSlide),i(this._attributes.nextSlide),d(this._attributes.container,this.settings.classes.touching),d(this._attributes.previousSlide,this.settings.classes.previousSlide),d(this._attributes.currentSlide,this.settings.classes.currentSlide),d(this._attributes.nextSlide,this.settings.classes.nextSlide),this._attributes.currentSlide.setAttribute("aria-hidden","true");var a=this._attributes.slides,b=a.indexOf(this._attributes.currentSlide);"next"==j.vars.direction?(this._attributes.previousSlide=this._attributes.currentSlide,this._attributes.currentSlide=a[b+1],this._attributes.nextSlide=a[b+2],"undefined"==typeof this._attributes.currentSlide&&"undefined"==typeof this._attributes.nextSlide?(this._attributes.currentSlide=a[0],this._attributes.nextSlide=a[1]):"undefined"==typeof this._attributes.nextSlide&&(this._attributes.nextSlide=a[0]),f(this._attributes.nextSlide)):(this._attributes.nextSlide=this._attributes.currentSlide,this._attributes.previousSlide=a[b-2],this._attributes.currentSlide=a[b-1],"undefined"==typeof this._attributes.currentSlide&&"undefined"==typeof this._attributes.previousSlide?(this._attributes.currentSlide=a[a.length-1],this._attributes.previousSlide=a[a.length-2]):"undefined"==typeof this._attributes.previousSlide&&(this._attributes.previousSlide=a[a.length-1]),f(this._attributes.previousSlide)),c(this._attributes.previousSlide,this.settings.classes.previousSlide),c(this._attributes.currentSlide,this.settings.classes.currentSlide),c(this._attributes.nextSlide,this.settings.classes.nextSlide),this._attributes.currentSlide.setAttribute("aria-hidden","false"),this.settings.afterChange.apply(this)}}},k=function(d){this.settings={selector:"",height:400,interval:4e3,transitionDuration:700,effect:"slide",disableNav:!1,keyboardNav:!0,previousNavSelector:"",nextNavSelector:"",classes:{container:"ideal-image-slider",slide:"iis-slide",previousSlide:"iis-previous-slide",currentSlide:"iis-current-slide",nextSlide:"iis-next-slide",previousNav:"iis-previous-nav",nextNav:"iis-next-nav",animating:"iis-is-animating",touching:"iis-is-touching",directionPrevious:"iis-direction-previous",directionNext:"iis-direction-next"},onInit:function(){},onStart:function(){},onStop:function(){},onDestroy:function(){},beforeChange:function(){},afterChange:function(){}},"string"==typeof d?this.settings.selector=d:"object"==typeof d&&a(this.settings,d);var h=document.querySelector(this.settings.selector);if(!h)return null;var i=e(h.children),k=[];h.innerHTML="",Array.prototype.forEach.call(i,function(b){if(b instanceof HTMLImageElement||b instanceof HTMLAnchorElement){var d=document.createElement("a"),e="",f="";if(b instanceof HTMLAnchorElement){e=b.getAttribute("href"),f=b.getAttribute("target");var i=b.querySelector("img");if(null===i)return;b=i}"undefined"!=typeof b.dataset?(a(d.dataset,b.dataset),d.dataset.src=b.dataset.src?b.dataset.src:b.src,g()&&b.dataset["src-2x"]&&(d.dataset.src=b.dataset["src-2x"])):b.getAttribute("data-src")?d.setAttribute("data-src",b.getAttribute("data-src")):d.setAttribute("data-src",b.getAttribute("src")),e&&d.setAttribute("href",e),f&&d.setAttribute("target",f),b.getAttribute("className")&&c(d,b.getAttribute("className")),b.getAttribute("id")&&d.setAttribute("id",b.id),b.getAttribute("alt")&&(d.innerHTML=b.getAttribute("alt")),d.setAttribute("role","tabpanel"),d.setAttribute("aria-hidden","true"),d.style.cssText+="-webkit-transition-duration:"+this.settings.transitionDuration+"ms;-moz-transition-duration:"+this.settings.transitionDuration+"ms;-o-transition-duration:"+this.settings.transitionDuration+"ms;transition-duration:"+this.settings.transitionDuration+"ms;",h.appendChild(d),k.push(d)}}.bind(this));var l=k;if(l.length<=1)return null;if(!this.settings.disableNav){var m,n;this.settings.previousNavSelector?m=document.querySelector(this.settings.previousNavSelector):(m=document.createElement("a"),h.appendChild(m)),this.settings.nextNavSelector?n=document.querySelector(this.settings.nextNavSelector):(n=document.createElement("a"),h.appendChild(n)),c(m,this.settings.classes.previousNav),c(n,this.settings.classes.nextNav),m.addEventListener("click",function(){return b(this._attributes.container,this.settings.classes.animating)?!1:(this.stop(),void this.previousSlide())}.bind(this)),n.addEventListener("click",function(){return b(this._attributes.container,this.settings.classes.animating)?!1:(this.stop(),void this.nextSlide())}.bind(this)),("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)&&(this.settings.effect="touch",m.style.display="none",n.style.display="none",h.addEventListener("touchstart",j.start.bind(this),!1),h.addEventListener("touchmove",j.move.bind(this),!1),h.addEventListener("touchend",j.end.bind(this),!1)),this.settings.keyboardNav&&document.addEventListener("keyup",function(a){a=a||window.event;var c="number"==typeof a.which?a.which:a.keyCode;if(37==c){if(b(this._attributes.container,this.settings.classes.animating))return!1;this.stop(),this.previousSlide()}else if(39==c){if(b(this._attributes.container,this.settings.classes.animating))return!1;this.stop(),this.nextSlide()}}.bind(this))}this._attributes={container:h,slides:l,previousSlide:"undefined"!=typeof l[l.length-1]?l[l.length-1]:l[0],currentSlide:l[0],nextSlide:"undefined"!=typeof l[1]?l[1]:l[0],timerId:0,origChildren:i},this.settings.height&&(this._attributes.container.style.height=this.settings.height+"px"),c(h,this.settings.classes.container),c(h,"iis-effect-"+this.settings.effect),Array.prototype.forEach.call(this._attributes.slides,function(a){c(a,this.settings.classes.slide)}.bind(this)),c(this._attributes.previousSlide,this.settings.classes.previousSlide),c(this._attributes.currentSlide,this.settings.classes.currentSlide),c(this._attributes.nextSlide,this.settings.classes.nextSlide),this._attributes.currentSlide.setAttribute("aria-hidden","false"),f(this._attributes.currentSlide,function(){this.settings.onInit.apply(this)}.bind(this)),f(this._attributes.previousSlide),f(this._attributes.nextSlide)};return k.prototype.get=function(a){return this._attributes.hasOwnProperty(a)?this._attributes[a]:void 0},k.prototype.set=function(a,b){return this._attributes[a]=b},k.prototype.start=function(){this._attributes.timerId=setInterval(this.nextSlide.bind(this),this.settings.interval),this.settings.onStart.apply(this),window.onblur=function(){this.stop()}.bind(this)},k.prototype.stop=function(){clearInterval(this._attributes.timerId),this._attributes.timerId=0,this.settings.onStop.apply(this)},k.prototype.previousSlide=function(){this.settings.beforeChange.apply(this),d(this._attributes.previousSlide,this.settings.classes.previousSlide),d(this._attributes.currentSlide,this.settings.classes.currentSlide),d(this._attributes.nextSlide,this.settings.classes.nextSlide),this._attributes.currentSlide.setAttribute("aria-hidden","true");var a=this._attributes.slides,b=a.indexOf(this._attributes.currentSlide);this._attributes.nextSlide=this._attributes.currentSlide,this._attributes.previousSlide=a[b-2],this._attributes.currentSlide=a[b-1],"undefined"==typeof this._attributes.currentSlide&&"undefined"==typeof this._attributes.previousSlide?(this._attributes.currentSlide=a[a.length-1],this._attributes.previousSlide=a[a.length-2]):"undefined"==typeof this._attributes.previousSlide&&(this._attributes.previousSlide=a[a.length-1]),f(this._attributes.previousSlide),c(this._attributes.previousSlide,this.settings.classes.previousSlide),c(this._attributes.currentSlide,this.settings.classes.currentSlide),c(this._attributes.nextSlide,this.settings.classes.nextSlide),this._attributes.currentSlide.setAttribute("aria-hidden","false"),c(this._attributes.container,this.settings.classes.directionPrevious),setTimeout(function(){d(this._attributes.container,this.settings.classes.directionPrevious)}.bind(this),this.settings.transitionDuration),this.settings.transitionDuration&&(c(this._attributes.container,this.settings.classes.animating),setTimeout(function(){d(this._attributes.container,this.settings.classes.animating)}.bind(this),this.settings.transitionDuration)),this.settings.afterChange.apply(this)},k.prototype.nextSlide=function(){this.settings.beforeChange.apply(this),d(this._attributes.previousSlide,this.settings.classes.previousSlide),d(this._attributes.currentSlide,this.settings.classes.currentSlide),d(this._attributes.nextSlide,this.settings.classes.nextSlide),this._attributes.currentSlide.setAttribute("aria-hidden","true");var a=this._attributes.slides,b=a.indexOf(this._attributes.currentSlide);this._attributes.previousSlide=this._attributes.currentSlide,this._attributes.currentSlide=a[b+1],this._attributes.nextSlide=a[b+2],"undefined"==typeof this._attributes.currentSlide&&"undefined"==typeof this._attributes.nextSlide?(this._attributes.currentSlide=a[0],this._attributes.nextSlide=a[1]):"undefined"==typeof this._attributes.nextSlide&&(this._attributes.nextSlide=a[0]),f(this._attributes.nextSlide),c(this._attributes.previousSlide,this.settings.classes.previousSlide),c(this._attributes.currentSlide,this.settings.classes.currentSlide),c(this._attributes.nextSlide,this.settings.classes.nextSlide),this._attributes.currentSlide.setAttribute("aria-hidden","false"),c(this._attributes.container,this.settings.classes.directionNext),setTimeout(function(){d(this._attributes.container,this.settings.classes.directionNext)}.bind(this),this.settings.transitionDuration),this.settings.transitionDuration&&(c(this._attributes.container,this.settings.classes.animating),setTimeout(function(){d(this._attributes.container,this.settings.classes.animating)}.bind(this),this.settings.transitionDuration)),this.settings.afterChange.apply(this)},k.prototype.gotoSlide=function(a){this.settings.beforeChange.apply(this),this.stop(),d(this._attributes.previousSlide,this.settings.classes.previousSlide),d(this._attributes.currentSlide,this.settings.classes.currentSlide),d(this._attributes.nextSlide,this.settings.classes.nextSlide),this._attributes.currentSlide.setAttribute("aria-hidden","true"),a--;var b=this._attributes.slides;this._attributes.previousSlide=b[a-1],this._attributes.currentSlide=b[a],this._attributes.nextSlide=b[a+1],"undefined"==typeof this._attributes.previousSlide&&(this._attributes.previousSlide=b[b.length-1]),"undefined"==typeof this._attributes.nextSlide&&(this._attributes.nextSlide=b[0]),f(this._attributes.previousSlide),f(this._attributes.currentSlide),f(this._attributes.nextSlide),c(this._attributes.previousSlide,this.settings.classes.previousSlide),c(this._attributes.currentSlide,this.settings.classes.currentSlide),c(this._attributes.nextSlide,this.settings.classes.nextSlide),this._attributes.currentSlide.setAttribute("aria-hidden","false"),this.settings.transitionDuration&&(c(this._attributes.container,this.settings.classes.animating),setTimeout(function(){d(this._attributes.container,this.settings.classes.animating)}.bind(this),this.settings.transitionDuration)),this.settings.afterChange.apply(this)},k.prototype.destroy=function(){clearInterval(this._attributes.timerId),this._attributes.timerId=0,this._attributes.container.innerHTML="",Array.prototype.forEach.call(this._attributes.origChildren,function(a){this._attributes.container.appendChild(a)}.bind(this)),d(this._attributes.container,this.settings.classes.container),d(this._attributes.container,"iis-effect-"+this.settings.effect),this._attributes.container.style.height="",this.settings.onDestroy.apply(this)},{Slider:k}}(); \ No newline at end of file