8 lines
95 KiB
JavaScript
8 lines
95 KiB
JavaScript
|
/*!
|
||
|
* - v1.6.0
|
||
|
* Homepage: http://bqworks.net/slider-pro/
|
||
|
* Author: bqworks
|
||
|
* Author URL: http://bqworks.net/
|
||
|
*/
|
||
|
|
||
|
!function(c,p){"use strict";p.SliderPro={modules:[],addModule:function(t,i){this.modules.push(t),p.extend(n.prototype,i)}};var m=p.SliderPro.namespace="SliderPro",n=function(t,i){this.instance=t,this.$slider=p(this.instance),this.$slides=null,this.$slidesMask=null,this.$slidesContainer=null,this.slides=[],this.slidesOrder=[],this.options=i,this.settings={},this.originalSettings={},this.originalGotoSlide=null,this.selectedSlideIndex=0,this.previousSlideIndex=0,this.middleSlidePosition=0,this.supportedAnimation=null,this.vendorPrefix=null,this.transitionEvent=null,this.positionProperty=null,this.sizeProperty=null,this.isIE=null,this.slidesPosition=0,this.slidesSize=0,this.averageSlideSize=0,this.slideWidth=0,this.slideHeight=0,this.previousSlideWidth=0,this.previousSlideHeight=0,this.previousWindowWidth=0,this.previousWindowHeight=0,this.allowResize=!0,this.uniqueId=(new Date).valueOf(),this.breakpoints=[],this.currentBreakpoint=-1,this.shuffledIndexes=[],this._init()};n.prototype={_init:function(){var e=this;this.supportedAnimation=g.getSupportedAnimation(),this.vendorPrefix=g.getVendorPrefix(),this.transitionEvent=g.getTransitionEvent(),this.isIE=g.checkIE(),this.$slider.removeClass("sp-no-js"),c.navigator.userAgent.match(/(iPad|iPhone|iPod)/g)&&this.$slider.addClass("ios");var t=/(msie) ([\w.]+)/.exec(c.navigator.userAgent.toLowerCase());this.isIE&&this.$slider.addClass("ie"),null!==t&&this.$slider.addClass("ie"+parseInt(t[2],10)),this.$slidesContainer=p('<div class="sp-slides-container"></div>').appendTo(this.$slider),this.$slidesMask=p('<div class="sp-mask"></div>').appendTo(this.$slidesContainer),this.$slides=this.$slider.find(".sp-slides").appendTo(this.$slidesMask),this.$slider.find(".sp-slide").appendTo(this.$slides);var i=p.SliderPro.modules;if(void 0!==i)for(var s=0;s<i.length;s++){var n=i[s].substring(0,1).toLowerCase()+i[s].substring(1)+"Defaults";void 0!==this[n]&&p.extend(this.defaults,this[n])}if(this.settings=p.extend({},this.defaults,this.options),void 0!==i)for(var o=0;o<i.length;o++)void 0!==this["init"+i[o]]&&this["init"+i[o]]();if(this.originalSettings=p.extend({},this.settings),this.originalGotoSlide=this.gotoSlide,null!==this.settings.breakpoints){for(var a in this.settings.breakpoints)this.breakpoints.push({size:parseInt(a,10),properties:this.settings.breakpoints[a]});this.breakpoints=this.breakpoints.sort(function(t,i){return t.size>=i.size?1:-1})}if(this.selectedSlideIndex=this.settings.startSlide,!0===this.settings.shuffle){var h=this.$slides.find(".sp-slide"),r=[];h.each(function(t){e.shuffledIndexes.push(t)});for(var l=this.shuffledIndexes.length-1;0<l;l--){var d=Math.floor(Math.random()*(l+1)),u=this.shuffledIndexes[l];this.shuffledIndexes[l]=this.shuffledIndexes[d],this.shuffledIndexes[d]=u}p.each(this.shuffledIndexes,function(t,i){r.push(h[i])}),this.$slides.empty().append(r)}p(c).on("resize."+this.uniqueId+"."+m,function(){var t=p(c).width(),i=p(c).height();!1===e.allowResize||e.previousWindowWidth===t&&e.previousWindowHeight===i||(e.previousWindowWidth=t,e.previousWindowHeight=i,e.allowResize=!1,setTimeout(function(){e.resize(),e.allowResize=!0},200))}),this.on("update."+m,function(){e.previousSlideWidth=0,e.resize()}),this.update(),this.$slides.find(".sp-slide").eq(this.selectedSlideIndex).addClass("sp-selected"),this.trigger({type:"init"}),p.isFunction(this.settings.init)&&this.settings.init.call(this,{type:"init"})},update:function(){var e=this;"horizontal"===this.settings.orientation?(this.$slider.removeClass("sp-vertical").addClass("sp-horizontal"),this.$slider.css({height:"","max-height":""}),this.$slides.find(".sp-slide").css("top","")):"vertical"===this.settings.orientation&&(this.$slider.removeClass("sp-horizontal").addClass("sp-vertical"),this.$slides.find(".sp-slide").css("left","")),!0===this.settings.rightToLeft?this.$slider.addClass("sp-rtl"):this.$slider.removeClass("sp-rtl"),this.positionProperty="horizontal"===this.settings.orientation?"left":"top",this.sizeProperty="horizontal"===this.settings.orientation?"width":"height",this.gotoSlide=this.originalGotoSlide;for(var t,
|