File "flickity-fade.min.js"
Full Path: /home/ycoalition/public_html/blog/wp-content/themes/woodmart/js/libs/flickity-fade.min.js
File size: 3.4 KB
MIME-type: text/plain
Charset: utf-8
!function(e,t){"function"==typeof define&&define.amd?define(["flickity/js/index","fizzy-ui-utils/utils"],t):"object"==typeof module&&module.exports?module.exports=t(require("flickity"),require("fizzy-ui-utils")):t(e.Flickity,e.fizzyUIUtils)}(this,function(e,s){var t=e.Slide,n=t.prototype.updateTarget,t=(t.prototype.updateTarget=function(){var i,s;n.apply(this,arguments),this.parent.options.fade&&(i=this.target-this.x,s=this.cells[0].x,this.cells.forEach(function(e){var t=e.x-s-i;e.renderPosition(t)}))},t.prototype.setOpacity=function(t){this.cells.forEach(function(e){e.element.style.opacity=t})},e.prototype),i=(e.createMethods.push("_createFade"),t._createFade=function(){this.fadeIndex=this.selectedIndex,this.prevSelectedIndex=this.selectedIndex,this.on("select",this.onSelectFade),this.on("dragEnd",this.onDragEndFade),this.on("settle",this.onSettleFade),this.on("activate",this.onActivateFade),this.on("deactivate",this.onDeactivateFade)},t.updateSlides),a=(t.updateSlides=function(){i.apply(this,arguments),this.options.fade&&this.slides.forEach(function(e,t){t=t==this.selectedIndex?1:0;e.setOpacity(t)},this)},t.onSelectFade=function(){this.fadeIndex=Math.min(this.prevSelectedIndex,this.slides.length-1),this.prevSelectedIndex=this.selectedIndex},t.onSettleFade=function(){delete this.didDragEnd,this.options.fade&&(this.selectedSlide.setOpacity(1),this.slides[this.fadeIndex]&&this.fadeIndex!=this.selectedIndex&&this.slides[this.fadeIndex].setOpacity(0))},t.onDragEndFade=function(){this.didDragEnd=!0},t.onActivateFade=function(){this.options.fade&&this.element.classList.add("is-fade")},t.onDeactivateFade=function(){this.options.fade&&(this.element.classList.remove("is-fade"),this.slides.forEach(function(e){e.setOpacity("")}))},t.positionSlider),d=(t.positionSlider=function(){this.options.fade?(this.fadeSlides(),this.dispatchScrollEvent()):a.apply(this,arguments)},t.positionSliderAtSelected),h=(t.positionSliderAtSelected=function(){this.options.fade&&this.setTranslateX(0),d.apply(this,arguments)},t.fadeSlides=function(){var e,t,i,s,n;this.slides.length<2||(e=this.getFadeIndexes(),n=this.slides[e.a],t=this.slides[e.b],i=this.wrapDifference(n.target,t.target),s=this.wrapDifference(n.target,-this.x),n.setOpacity(1-(s/=i)),t.setOpacity(s),n=e.a,this.isDragging&&(n=.5<s?e.a:e.b),null!=this.fadeHideIndex&&this.fadeHideIndex!=n&&this.fadeHideIndex!=e.a&&this.fadeHideIndex!=e.b&&this.slides[this.fadeHideIndex].setOpacity(0),this.fadeHideIndex=n)},t.getFadeIndexes=function(){return this.isDragging||this.didDragEnd?this.options.wrapAround?this.getFadeDragWrapIndexes():this.getFadeDragLimitIndexes():{a:this.fadeIndex,b:this.selectedIndex}},t.getFadeDragWrapIndexes=function(){var e=this.slides.map(function(e,t){return this.getSlideDistance(-this.x,t)},this),t=e.map(function(e){return Math.abs(e)}),i=Math.min.apply(Math,t),t=t.indexOf(i),i=e[t],e=this.slides.length;return{a:t,b:s.modulo(t+(0<=i?1:-1),e)}},t.getFadeDragLimitIndexes=function(){for(var e=0,t=0;t<this.slides.length-1;t++){var i=this.slides[t];if(-this.x<i.target)break;e=t}return{a:e,b:e+1}},t.wrapDifference=function(e,t){t-=e;if(!this.options.wrapAround)return t;var e=t+this.slideableWidth,i=t-this.slideableWidth;return Math.abs(e)<Math.abs(t)&&(t=e),t=Math.abs(i)<Math.abs(t)?i:t},t._getWrapShiftCells),o=(t._getWrapShiftCells=function(){this.options.fade||h.apply(this,arguments)},t.shiftWrapCells);return t.shiftWrapCells=function(){this.options.fade||o.apply(this,arguments)},e});