From 7a447072045c0655757a51d90ada2b9dbd781661 Mon Sep 17 00:00:00 2001 From: Kevin Farrugia Date: Tue, 21 Mar 2023 23:29:48 +0100 Subject: [PATCH 1/2] Added support for scroll-snap --- glider.css | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/glider.css b/glider.css index 4422543..aec35b7 100644 --- a/glider.css +++ b/glider.css @@ -45,7 +45,8 @@ opacity: 0; height: 0; } -.glider-prev,.glider-next { +.glider-prev, +.glider-next { user-select: none; position: absolute; outline: none; @@ -61,8 +62,8 @@ color: #666; opacity: 1; line-height: 1; - transition: opacity .5s cubic-bezier(.17,.67,.83,.67), - color .5s cubic-bezier(.17,.67,.83,.67); + transition: opacity 0.5s cubic-bezier(0.17, 0.67, 0.83, 0.67), + color 0.5s cubic-bezier(0.17, 0.67, 0.83, 0.67); } .glider-prev:hover, .glider-next:hover, @@ -76,7 +77,7 @@ } .glider-next.disabled, .glider-prev.disabled { - opacity: .25; + opacity: 0.25; color: #666; cursor: default; } @@ -113,7 +114,7 @@ .glider-dot.active { background: #a89cc8; } -@media(max-width: 36em){ +@media (max-width: 36em) { .glider::-webkit-scrollbar { opacity: 1; -webkit-appearance: none; @@ -124,6 +125,15 @@ opacity: 1; border-radius: 99px; background-color: rgba(156, 156, 156, 0.25); - box-shadow: 0 0 1px rgba(255,255,255,.25); + box-shadow: 0 0 1px rgba(255, 255, 255, 0.25); } } +@media screen and (pointer: coarse), (pointer: none) { + .glider-track { + scroll-snap-type: x mandatory; + scroll-padding: 0; + } + .glider-slide { + scroll-snap-align: start; + } +} \ No newline at end of file From a38e87365d0985793ed92160834a62b608b99b7d Mon Sep 17 00:00:00 2001 From: Kevin Farrugia Date: Tue, 21 Mar 2023 23:50:09 +0100 Subject: [PATCH 2/2] Removed JavaScript scrollLock implementation in favor of CSS --- README.md | 3 --- docs/assets/css/main.css | 9 ++++++++- docs/assets/js/glider.min.js | 2 +- docs/index.html | 6 ------ glider.css | 16 +++++++--------- glider.js | 20 ++++---------------- glider.min.js | 2 +- yarn.lock | 21 ++++----------------- 8 files changed, 25 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index 27accd4..92e8248 100644 --- a/README.md +++ b/README.md @@ -92,9 +92,6 @@ new Glider(document.querySelector('.glider'), { // Force centering slide after scroll event scrollLock: false, - // how long to wait after scroll event before locking - // if too low, it might interrupt normal scrolling - scrollLockDelay: 150, // Force centering slide after resize event resizeLock: true, diff --git a/docs/assets/css/main.css b/docs/assets/css/main.css index 3f3d977..012e23c 100644 --- a/docs/assets/css/main.css +++ b/docs/assets/css/main.css @@ -4551,4 +4551,11 @@ user-select: none; /* Standard */ #glider-persp { overflow: hidden; } -} \ No newline at end of file +} +.scroll-lock { + scroll-snap-type: x mandatory; + scroll-padding: 0; +} +.scroll-lock .glider-slide { + scroll-snap-align: start; +} diff --git a/docs/assets/js/glider.min.js b/docs/assets/js/glider.min.js index 0ef2d37..8234cca 100644 --- a/docs/assets/js/glider.min.js +++ b/docs/assets/js/glider.min.js @@ -13,4 +13,4 @@ Release Date: October 25th, 2018 */ -!function(e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():e()}(function(){var a="undefined"!=typeof window?window:this,e=a.Glider=function(e,t){var o=this;if(e._glider)return e._glider;if(o.ele=e,o.ele.classList.add("glider"),(o.ele._glider=o).opt=Object.assign({},{slidesToScroll:1,slidesToShow:1,resizeLock:!0,duration:.5,easing:function(e,t,o,i,r){return i*(t/=r)*t+o}},t),o.animate_id=o.page=o.slide=0,o.arrows={},o._opt=o.opt,o.opt.skipTrack)o.track=o.ele.children[0];else for(o.track=document.createElement("div"),o.ele.appendChild(o.track);1!==o.ele.children.length;)o.track.appendChild(o.ele.children[0]);o.track.classList.add("glider-track"),o.init(),o.resize=o.init.bind(o,!0),o.event(o.ele,"add",{scroll:o.updateControls.bind(o)}),o.event(a,"add",{resize:o.resize})},t=e.prototype;return t.init=function(e,t){var o,i=this,r=0,s=0,l=(i.slides=i.track.children,[].forEach.call(i.slides,function(e,t){e.classList.add("glider-slide"),e.setAttribute("data-gslide",t)}),i.containerWidth=i.ele.clientWidth,i.settingsBreakpoint());t=t||l,"auto"!==i.opt.slidesToShow&&void 0===i.opt._autoSlide||(o=i.containerWidth/i.opt.itemWidth,i.opt._autoSlide=i.opt.slidesToShow=i.opt.exactWidth?o:Math.max(1,Math.floor(o))),"auto"===i.opt.slidesToScroll&&(i.opt.slidesToScroll=Math.floor(i.opt.slidesToShow)),i.itemWidth=i.opt.exactWidth?i.opt.itemWidth:i.containerWidth/i.opt.slidesToShow,[].forEach.call(i.slides,function(e){e.style.height="auto",e.style.width=i.itemWidth+"px",r+=i.itemWidth,s=Math.max(e.offsetHeight,s)}),i.track.style.width=r+"px",i.trackWidth=r,i.isDrag=!1,i.preventClick=!1,i.move=!1,i.opt.resizeLock&&i.scrollTo(i.slide*i.itemWidth,0),(l||t)&&(i.bindArrows(),i.buildDots(),i.bindDrag()),i.updateControls(),i.emit(e?"refresh":"loaded")},t.bindDrag=function(){function e(){t.mouseDown=void 0,t.ele.classList.remove("drag"),t.isDrag&&(t.preventClick=!0),t.isDrag=!1}var t=this;t.mouse=t.mouse||t.handleMouse.bind(t);function o(){t.move=!0}var i={mouseup:e,mouseleave:e,mousedown:function(e){e.preventDefault(),e.stopPropagation(),t.mouseDown=e.clientX,t.ele.classList.add("drag"),t.move=!1,setTimeout(o,300)},touchstart:function(e){t.ele.classList.add("drag"),t.move=!1,setTimeout(o,300)},mousemove:t.mouse,click:function(e){t.preventClick&&t.move&&(e.preventDefault(),e.stopPropagation()),t.preventClick=!1,t.move=!1}};t.ele.classList.toggle("draggable",!0===t.opt.draggable),t.event(t.ele,"remove",i),t.opt.draggable&&t.event(t.ele,"add",i)},t.buildDots=function(){var e=this;if(e.opt.dots){if("string"==typeof e.opt.dots?e.dots=document.querySelector(e.opt.dots):e.dots=e.opt.dots,e.dots){e.dots.innerHTML="",e.dots.setAttribute("role","tablist"),e.dots.classList.add("glider-dots");for(var t=0;t=n.trackWidth),a=(n.opt.rewind||(n.arrows.prev&&(n.arrows.prev.classList.toggle("disabled",n.ele.scrollLeft<=0||t),n.arrows.prev.setAttribute("aria-disabled",n.arrows.prev.classList.contains("disabled"))),n.arrows.next&&(n.arrows.next.classList.toggle("disabled",Math.ceil(n.ele.scrollLeft+n.containerWidth)>=Math.floor(n.trackWidth)||t),n.arrows.next.setAttribute("aria-disabled",n.arrows.next.classList.contains("disabled")))),n.slide=Math.round(n.ele.scrollLeft/n.itemWidth),n.page=Math.round(n.ele.scrollLeft/n.containerWidth),n.slide+Math.floor(Math.floor(n.opt.slidesToShow)/2)),d=Math.floor(n.opt.slidesToShow)%2?0:a+1;1===Math.floor(n.opt.slidesToShow)&&(d=0),n.ele.scrollLeft+n.containerWidth>=Math.floor(n.trackWidth)&&(n.page=n.dots?n.dots.children.length-1:0),[].forEach.call(n.slides,function(e,t){var o=e.classList,e=o.contains("visible"),i=n.ele.scrollLeft,r=n.ele.scrollLeft+n.containerWidth,s=n.itemWidth*t,l=s+n.itemWidth,s=([].forEach.call(o,function(e){/^left|right/.test(e)&&o.remove(e)}),o.toggle("active",n.slide===t),a===t||d&&d===t?o.add("center"):(o.remove("center"),o.add([t=Math.floor(i)&&Math.floor(l)<=Math.ceil(r));o.toggle("visible",s),s!==e&&n.emit("slide-"+(s?"visible":"hidden"),{slide:t})}),n.dots&&[].forEach.call(n.dots.children,function(e,t){e.classList.toggle("active",n.page===t)}),e&&n.opt.scrollLock&&(clearTimeout(n.scrollLock),n.scrollLock=setTimeout(function(){clearTimeout(n.scrollLock),.02n.containerWidth+n.ele.scrollLeft&&n.scrollItem(n.getCurrentSlide()))},n.opt.scrollLockDelay||250))},t.getCurrentSlide=function(){return this.round(this.ele.scrollLeft/this.itemWidth)},t.scrollItem=function(e,t,o){o&&o.preventDefault();var i,r=this,s=e,o=(++r.animate_id,r.slide),l=!0===t?(e=Math.round(e*r.containerWidth/r.itemWidth))*r.itemWidth:("string"==typeof e&&(l="prev"===e,e=r.opt.slidesToScroll%1||r.opt.slidesToShow%1?r.getCurrentSlide():r.slide,l?e-=r.opt.slidesToScroll:e+=r.opt.slidesToScroll,r.opt.rewind&&(i=r.ele.scrollLeft,e=l&&!i?r.slides.length:!l&&i+r.containerWidth>=Math.floor(r.trackWidth)?0:e)),e=Math.max(Math.min(e,r.slides.length),0),r.slide=e,r.itemWidth*e);return r.emit("scroll-item",{prevSlide:o,slide:e}),r.scrollTo(l,r.opt.duration*Math.abs(r.ele.scrollLeft-l),function(){r.updateControls(),r.emit("animated",{value:s,type:"string"==typeof s?"arrow":t?"dot":"slide"})}),!1},t.settingsBreakpoint=function(){var e=this,t=e._opt.responsive;if(t){t.sort(function(e,t){return t.breakpoint-e.breakpoint});for(var o=0;o=i.breakpoint)return e.breakpoint!==i.breakpoint&&(e.opt=Object.assign({},e._opt,i.settings),e.breakpoint=i.breakpoint,!0)}}var r=0!==e.breakpoint;return e.opt=Object.assign({},e._opt),e.breakpoint=0,r},t.scrollTo=function(t,o,i){var r=this,s=(new Date).getTime(),l=r.animate_id,n=function(){var e=(new Date).getTime()-s;r.ele.scrollLeft=r.ele.scrollLeft+(t-r.ele.scrollLeft)*r.opt.easing(0,e,0,1,o),e=n.trackWidth),a=(n.opt.rewind||(n.arrows.prev&&(n.arrows.prev.classList.toggle("disabled",n.ele.scrollLeft<=0||e),n.arrows.prev.setAttribute("aria-disabled",n.arrows.prev.classList.contains("disabled"))),n.arrows.next&&(n.arrows.next.classList.toggle("disabled",Math.ceil(n.ele.scrollLeft+n.containerWidth)>=Math.floor(n.trackWidth)||e),n.arrows.next.setAttribute("aria-disabled",n.arrows.next.classList.contains("disabled")))),n.slide=Math.round(n.ele.scrollLeft/n.itemWidth),n.page=Math.round(n.ele.scrollLeft/n.containerWidth),n.slide+Math.floor(Math.floor(n.opt.slidesToShow)/2)),d=Math.floor(n.opt.slidesToShow)%2?0:a+1;1===Math.floor(n.opt.slidesToShow)&&(d=0),n.ele.scrollLeft+n.containerWidth>=Math.floor(n.trackWidth)&&(n.page=n.dots?n.dots.children.length-1:0),[].forEach.call(n.slides,function(e,t){var i=e.classList,e=i.contains("visible"),o=n.ele.scrollLeft,s=n.ele.scrollLeft+n.containerWidth,r=n.itemWidth*t,l=r+n.itemWidth,r=([].forEach.call(i,function(e){/^left|right/.test(e)&&i.remove(e)}),i.toggle("active",n.slide===t),a===t||d&&d===t?i.add("center"):(i.remove("center"),i.add([t=Math.floor(o)&&Math.floor(l)<=Math.ceil(s));i.toggle("visible",r),r!==e&&n.emit("slide-"+(r?"visible":"hidden"),{slide:t})}),n.dots&&[].forEach.call(n.dots.children,function(e,t){e.classList.toggle("active",n.page===t)})},t.getCurrentSlide=function(){return this.round(this.ele.scrollLeft/this.itemWidth)},t.scrollItem=function(e,t,i){i&&i.preventDefault();var o,s=this,r=e,i=(++s.animate_id,s.slide),l=!0===t?(e=Math.round(e*s.containerWidth/s.itemWidth))*s.itemWidth:("string"==typeof e&&(l="prev"===e,e=s.opt.slidesToScroll%1||s.opt.slidesToShow%1?s.getCurrentSlide():s.slide,l?e-=s.opt.slidesToScroll:e+=s.opt.slidesToScroll,s.opt.rewind)&&(o=s.ele.scrollLeft,e=l&&!o?s.slides.length:!l&&o+s.containerWidth>=Math.floor(s.trackWidth)?0:e),e=Math.max(Math.min(e,s.slides.length),0),s.slide=e,s.itemWidth*e);return s.emit("scroll-item",{prevSlide:i,slide:e}),s.scrollTo(l,s.opt.duration*Math.abs(s.ele.scrollLeft-l),function(){s.updateControls(),s.emit("animated",{value:r,type:"string"==typeof r?"arrow":t?"dot":"slide"})}),!1},t.settingsBreakpoint=function(){var e=this,t=e._opt.responsive;if(t){t.sort(function(e,t){return t.breakpoint-e.breakpoint});for(var i=0;i=o.breakpoint)return e.breakpoint!==o.breakpoint&&(e.opt=Object.assign({},e._opt,o.settings),e.breakpoint=o.breakpoint,!0)}}var s=0!==e.breakpoint;return e.opt=Object.assign({},e._opt),e.breakpoint=0,s},t.scrollTo=function(t,i,o){var s=this,r=(new Date).getTime(),l=s.animate_id,n=function(){var e=(new Date).getTime()-r;s.ele.scrollLeft=s.ele.scrollLeft+(t-s.ele.scrollLeft)*s.opt.easing(0,e,0,1,i),eSettings Default: false
If true, Glider.js will scroll to the nearest slide after any scroll interactions -
  • - scrollLockDelay
    - Type: Number
    - Default: 250
    - When scrollLock is set, this is the delay in milliseconds to wait before the scroll happens -
  • resizeLock
    Type: Boolean
    diff --git a/glider.css b/glider.css index aec35b7..fccc5ec 100644 --- a/glider.css +++ b/glider.css @@ -128,12 +128,10 @@ box-shadow: 0 0 1px rgba(255, 255, 255, 0.25); } } -@media screen and (pointer: coarse), (pointer: none) { - .glider-track { - scroll-snap-type: x mandatory; - scroll-padding: 0; - } - .glider-slide { - scroll-snap-align: start; - } -} \ No newline at end of file +.scroll-lock { + scroll-snap-type: x mandatory; + scroll-padding: 0; +} +.scroll-lock .glider-slide { + scroll-snap-align: start; +} diff --git a/glider.js b/glider.js index 4fbec20..525cc67 100644 --- a/glider.js +++ b/glider.js @@ -77,6 +77,10 @@ _.track.classList.add('glider-track') + if (_.opt.scrollLock) { + _.ele.classList.add('scroll-lock') + } + // start glider _.init() @@ -356,22 +360,6 @@ dot.classList.toggle('active', _.page === index) }) } - - if (event && _.opt.scrollLock) { - clearTimeout(_.scrollLock) - _.scrollLock = setTimeout(function () { - clearTimeout(_.scrollLock) - // dont attempt to scroll less than a pixel fraction - causes looping - if (Math.abs(_.ele.scrollLeft / _.itemWidth - _.slide) > 0.02) { - if (!_.mouseDown) { - // Only scroll if not at the end (#94) - if (_.trackWidth > _.containerWidth + _.ele.scrollLeft) { - _.scrollItem(_.getCurrentSlide()) - } - } - } - }, _.opt.scrollLockDelay || 250) - } } gliderPrototype.getCurrentSlide = function () { diff --git a/glider.min.js b/glider.min.js index 0ef2d37..8234cca 100644 --- a/glider.min.js +++ b/glider.min.js @@ -13,4 +13,4 @@ Release Date: October 25th, 2018 */ -!function(e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():e()}(function(){var a="undefined"!=typeof window?window:this,e=a.Glider=function(e,t){var o=this;if(e._glider)return e._glider;if(o.ele=e,o.ele.classList.add("glider"),(o.ele._glider=o).opt=Object.assign({},{slidesToScroll:1,slidesToShow:1,resizeLock:!0,duration:.5,easing:function(e,t,o,i,r){return i*(t/=r)*t+o}},t),o.animate_id=o.page=o.slide=0,o.arrows={},o._opt=o.opt,o.opt.skipTrack)o.track=o.ele.children[0];else for(o.track=document.createElement("div"),o.ele.appendChild(o.track);1!==o.ele.children.length;)o.track.appendChild(o.ele.children[0]);o.track.classList.add("glider-track"),o.init(),o.resize=o.init.bind(o,!0),o.event(o.ele,"add",{scroll:o.updateControls.bind(o)}),o.event(a,"add",{resize:o.resize})},t=e.prototype;return t.init=function(e,t){var o,i=this,r=0,s=0,l=(i.slides=i.track.children,[].forEach.call(i.slides,function(e,t){e.classList.add("glider-slide"),e.setAttribute("data-gslide",t)}),i.containerWidth=i.ele.clientWidth,i.settingsBreakpoint());t=t||l,"auto"!==i.opt.slidesToShow&&void 0===i.opt._autoSlide||(o=i.containerWidth/i.opt.itemWidth,i.opt._autoSlide=i.opt.slidesToShow=i.opt.exactWidth?o:Math.max(1,Math.floor(o))),"auto"===i.opt.slidesToScroll&&(i.opt.slidesToScroll=Math.floor(i.opt.slidesToShow)),i.itemWidth=i.opt.exactWidth?i.opt.itemWidth:i.containerWidth/i.opt.slidesToShow,[].forEach.call(i.slides,function(e){e.style.height="auto",e.style.width=i.itemWidth+"px",r+=i.itemWidth,s=Math.max(e.offsetHeight,s)}),i.track.style.width=r+"px",i.trackWidth=r,i.isDrag=!1,i.preventClick=!1,i.move=!1,i.opt.resizeLock&&i.scrollTo(i.slide*i.itemWidth,0),(l||t)&&(i.bindArrows(),i.buildDots(),i.bindDrag()),i.updateControls(),i.emit(e?"refresh":"loaded")},t.bindDrag=function(){function e(){t.mouseDown=void 0,t.ele.classList.remove("drag"),t.isDrag&&(t.preventClick=!0),t.isDrag=!1}var t=this;t.mouse=t.mouse||t.handleMouse.bind(t);function o(){t.move=!0}var i={mouseup:e,mouseleave:e,mousedown:function(e){e.preventDefault(),e.stopPropagation(),t.mouseDown=e.clientX,t.ele.classList.add("drag"),t.move=!1,setTimeout(o,300)},touchstart:function(e){t.ele.classList.add("drag"),t.move=!1,setTimeout(o,300)},mousemove:t.mouse,click:function(e){t.preventClick&&t.move&&(e.preventDefault(),e.stopPropagation()),t.preventClick=!1,t.move=!1}};t.ele.classList.toggle("draggable",!0===t.opt.draggable),t.event(t.ele,"remove",i),t.opt.draggable&&t.event(t.ele,"add",i)},t.buildDots=function(){var e=this;if(e.opt.dots){if("string"==typeof e.opt.dots?e.dots=document.querySelector(e.opt.dots):e.dots=e.opt.dots,e.dots){e.dots.innerHTML="",e.dots.setAttribute("role","tablist"),e.dots.classList.add("glider-dots");for(var t=0;t=n.trackWidth),a=(n.opt.rewind||(n.arrows.prev&&(n.arrows.prev.classList.toggle("disabled",n.ele.scrollLeft<=0||t),n.arrows.prev.setAttribute("aria-disabled",n.arrows.prev.classList.contains("disabled"))),n.arrows.next&&(n.arrows.next.classList.toggle("disabled",Math.ceil(n.ele.scrollLeft+n.containerWidth)>=Math.floor(n.trackWidth)||t),n.arrows.next.setAttribute("aria-disabled",n.arrows.next.classList.contains("disabled")))),n.slide=Math.round(n.ele.scrollLeft/n.itemWidth),n.page=Math.round(n.ele.scrollLeft/n.containerWidth),n.slide+Math.floor(Math.floor(n.opt.slidesToShow)/2)),d=Math.floor(n.opt.slidesToShow)%2?0:a+1;1===Math.floor(n.opt.slidesToShow)&&(d=0),n.ele.scrollLeft+n.containerWidth>=Math.floor(n.trackWidth)&&(n.page=n.dots?n.dots.children.length-1:0),[].forEach.call(n.slides,function(e,t){var o=e.classList,e=o.contains("visible"),i=n.ele.scrollLeft,r=n.ele.scrollLeft+n.containerWidth,s=n.itemWidth*t,l=s+n.itemWidth,s=([].forEach.call(o,function(e){/^left|right/.test(e)&&o.remove(e)}),o.toggle("active",n.slide===t),a===t||d&&d===t?o.add("center"):(o.remove("center"),o.add([t=Math.floor(i)&&Math.floor(l)<=Math.ceil(r));o.toggle("visible",s),s!==e&&n.emit("slide-"+(s?"visible":"hidden"),{slide:t})}),n.dots&&[].forEach.call(n.dots.children,function(e,t){e.classList.toggle("active",n.page===t)}),e&&n.opt.scrollLock&&(clearTimeout(n.scrollLock),n.scrollLock=setTimeout(function(){clearTimeout(n.scrollLock),.02n.containerWidth+n.ele.scrollLeft&&n.scrollItem(n.getCurrentSlide()))},n.opt.scrollLockDelay||250))},t.getCurrentSlide=function(){return this.round(this.ele.scrollLeft/this.itemWidth)},t.scrollItem=function(e,t,o){o&&o.preventDefault();var i,r=this,s=e,o=(++r.animate_id,r.slide),l=!0===t?(e=Math.round(e*r.containerWidth/r.itemWidth))*r.itemWidth:("string"==typeof e&&(l="prev"===e,e=r.opt.slidesToScroll%1||r.opt.slidesToShow%1?r.getCurrentSlide():r.slide,l?e-=r.opt.slidesToScroll:e+=r.opt.slidesToScroll,r.opt.rewind&&(i=r.ele.scrollLeft,e=l&&!i?r.slides.length:!l&&i+r.containerWidth>=Math.floor(r.trackWidth)?0:e)),e=Math.max(Math.min(e,r.slides.length),0),r.slide=e,r.itemWidth*e);return r.emit("scroll-item",{prevSlide:o,slide:e}),r.scrollTo(l,r.opt.duration*Math.abs(r.ele.scrollLeft-l),function(){r.updateControls(),r.emit("animated",{value:s,type:"string"==typeof s?"arrow":t?"dot":"slide"})}),!1},t.settingsBreakpoint=function(){var e=this,t=e._opt.responsive;if(t){t.sort(function(e,t){return t.breakpoint-e.breakpoint});for(var o=0;o=i.breakpoint)return e.breakpoint!==i.breakpoint&&(e.opt=Object.assign({},e._opt,i.settings),e.breakpoint=i.breakpoint,!0)}}var r=0!==e.breakpoint;return e.opt=Object.assign({},e._opt),e.breakpoint=0,r},t.scrollTo=function(t,o,i){var r=this,s=(new Date).getTime(),l=r.animate_id,n=function(){var e=(new Date).getTime()-s;r.ele.scrollLeft=r.ele.scrollLeft+(t-r.ele.scrollLeft)*r.opt.easing(0,e,0,1,o),e=n.trackWidth),a=(n.opt.rewind||(n.arrows.prev&&(n.arrows.prev.classList.toggle("disabled",n.ele.scrollLeft<=0||e),n.arrows.prev.setAttribute("aria-disabled",n.arrows.prev.classList.contains("disabled"))),n.arrows.next&&(n.arrows.next.classList.toggle("disabled",Math.ceil(n.ele.scrollLeft+n.containerWidth)>=Math.floor(n.trackWidth)||e),n.arrows.next.setAttribute("aria-disabled",n.arrows.next.classList.contains("disabled")))),n.slide=Math.round(n.ele.scrollLeft/n.itemWidth),n.page=Math.round(n.ele.scrollLeft/n.containerWidth),n.slide+Math.floor(Math.floor(n.opt.slidesToShow)/2)),d=Math.floor(n.opt.slidesToShow)%2?0:a+1;1===Math.floor(n.opt.slidesToShow)&&(d=0),n.ele.scrollLeft+n.containerWidth>=Math.floor(n.trackWidth)&&(n.page=n.dots?n.dots.children.length-1:0),[].forEach.call(n.slides,function(e,t){var i=e.classList,e=i.contains("visible"),o=n.ele.scrollLeft,s=n.ele.scrollLeft+n.containerWidth,r=n.itemWidth*t,l=r+n.itemWidth,r=([].forEach.call(i,function(e){/^left|right/.test(e)&&i.remove(e)}),i.toggle("active",n.slide===t),a===t||d&&d===t?i.add("center"):(i.remove("center"),i.add([t=Math.floor(o)&&Math.floor(l)<=Math.ceil(s));i.toggle("visible",r),r!==e&&n.emit("slide-"+(r?"visible":"hidden"),{slide:t})}),n.dots&&[].forEach.call(n.dots.children,function(e,t){e.classList.toggle("active",n.page===t)})},t.getCurrentSlide=function(){return this.round(this.ele.scrollLeft/this.itemWidth)},t.scrollItem=function(e,t,i){i&&i.preventDefault();var o,s=this,r=e,i=(++s.animate_id,s.slide),l=!0===t?(e=Math.round(e*s.containerWidth/s.itemWidth))*s.itemWidth:("string"==typeof e&&(l="prev"===e,e=s.opt.slidesToScroll%1||s.opt.slidesToShow%1?s.getCurrentSlide():s.slide,l?e-=s.opt.slidesToScroll:e+=s.opt.slidesToScroll,s.opt.rewind)&&(o=s.ele.scrollLeft,e=l&&!o?s.slides.length:!l&&o+s.containerWidth>=Math.floor(s.trackWidth)?0:e),e=Math.max(Math.min(e,s.slides.length),0),s.slide=e,s.itemWidth*e);return s.emit("scroll-item",{prevSlide:i,slide:e}),s.scrollTo(l,s.opt.duration*Math.abs(s.ele.scrollLeft-l),function(){s.updateControls(),s.emit("animated",{value:r,type:"string"==typeof r?"arrow":t?"dot":"slide"})}),!1},t.settingsBreakpoint=function(){var e=this,t=e._opt.responsive;if(t){t.sort(function(e,t){return t.breakpoint-e.breakpoint});for(var i=0;i=o.breakpoint)return e.breakpoint!==o.breakpoint&&(e.opt=Object.assign({},e._opt,o.settings),e.breakpoint=o.breakpoint,!0)}}var s=0!==e.breakpoint;return e.opt=Object.assign({},e._opt),e.breakpoint=0,s},t.scrollTo=function(t,i,o){var s=this,r=(new Date).getTime(),l=s.animate_id,n=function(){var e=(new Date).getTime()-r;s.ele.scrollLeft=s.ele.scrollLeft+(t-s.ele.scrollLeft)*s.opt.easing(0,e,0,1,i),e