/**************************************************************** * * * 素材火 * * www.sucaihuo.com * * 努力创建完善、持续更新源码以及模板 * * * ****************************************************************/ /** * bxslider v4.1.2 - fully loaded, responsive content slider * http://bxslider.com * * copyright 2014, steven wanderski - http://stevenwanderski.com - http://bxcreative.com * written while drinking belgian ales and listening to jazz * * released under the mit license - http://opensource.org/licenses/mit */ !function(t){var e={},s={mode:"horizontal",slideselector:"",infiniteloop:!0,hidecontrolonend:!1,speed:500,easing:null,slidemargin:0,startslide:0,randomstart:!1,captions:!1,ticker:!1,tickerhover:!1,adaptiveheight:!1,adaptiveheightspeed:500,video:!1,usecss:!0,preloadimages:"visible",responsive:!0,slidezindex:50,touchenabled:!0,swipethreshold:50,onetoonetouch:!0,preventdefaultswipex:!0,preventdefaultswipey:!1,pager:!0,pagertype:"full",pagershortseparator:" / ",pagerselector:null,buildpager:null,pagercustom:null,controls:!0,nexttext:"next",prevtext:"prev",nextselector:null,prevselector:null,autocontrols:!1,starttext:"start",stoptext:"stop",autocontrolscombine:!1,autocontrolsselector:null,auto:!1,pause:4e3,autostart:!0,autodirection:"next",autohover:!1,autodelay:0,minslides:1,maxslides:1,moveslides:0,slidewidth:0,onsliderload:function(){},onslidebefore:function(){},onslideafter:function(){},onslidenext:function(){},onslideprev:function(){},onsliderresize:function(){}};t.fn.bxslider=function(n){if(0==this.length)return this;if(this.length>1)return this.each(function(){t(this).bxslider(n)}),this;var o={},r=this;e.el=this;var a=t(window).width(),l=t(window).height(),d=function(){o.settings=t.extend({},s,n),o.settings.slidewidth=parseint(o.settings.slidewidth),o.children=r.children(o.settings.slideselector),o.children.length1||o.settings.maxslides>1,o.carousel&&(o.settings.preloadimages="all"),o.minthreshold=o.settings.minslides*o.settings.slidewidth+(o.settings.minslides-1)*o.settings.slidemargin,o.maxthreshold=o.settings.maxslides*o.settings.slidewidth+(o.settings.maxslides-1)*o.settings.slidemargin,o.working=!1,o.controls={},o.interval=null,o.animprop="vertical"==o.settings.mode?"top":"left",o.usingcss=o.settings.usecss&&"fade"!=o.settings.mode&&function(){var t=document.createelement("div"),e=["webkitperspective","mozperspective","operspective","msperspective"];for(var i in e)if(void 0!==t.style[e[i]])return o.cssprefix=e[i].replace("perspective","").tolowercase(),o.animprop="-"+o.cssprefix+"-transform",!0;return!1}(),"vertical"==o.settings.mode&&(o.settings.maxslides=o.settings.minslides),r.data("origstyle",r.attr("style")),r.children(o.settings.slideselector).each(function(){t(this).data("origstyle",t(this).attr("style"))}),c()},c=function(){r.wrap('
'),o.viewport=r.parent(),o.loader=t('
'),o.viewport.prepend(o.loader),r.css({width:"horizontal"==o.settings.mode?100*o.children.length+215+"%":"auto",position:"relative"}),o.usingcss&&o.settings.easing?r.css("-"+o.cssprefix+"-transition-timing-function",o.settings.easing):o.settings.easing||(o.settings.easing="swing"),f(),o.viewport.css({width:"100%",overflow:"hidden",position:"relative"}),o.viewport.parent().css({maxwidth:p()}),o.settings.pager||o.viewport.parent().css({margin:"0 auto 0px"}),o.children.css({"float":"horizontal"==o.settings.mode?"left":"none",liststyle:"none",position:"relative"}),o.children.css("width",u()),"horizontal"==o.settings.mode&&o.settings.slidemargin>0&&o.children.css("marginright",o.settings.slidemargin),"vertical"==o.settings.mode&&o.settings.slidemargin>0&&o.children.css("marginbottom",o.settings.slidemargin),"fade"==o.settings.mode&&(o.children.css({position:"absolute",zindex:0,display:"none"}),o.children.eq(o.settings.startslide).css({zindex:o.settings.slidezindex,display:"block"})),o.controls.el=t('
'),o.settings.captions&&p(),o.active.last=o.settings.startslide==x()-1,o.settings.video&&r.fitvids();var e=o.children.eq(o.settings.startslide);"all"==o.settings.preloadimages&&(e=o.children),o.settings.ticker?o.settings.pager=!1:(o.settings.pager&&t(),o.settings.controls&&c(),o.settings.auto&&o.settings.autocontrols&&e(),(o.settings.controls||o.settings.autocontrols||o.settings.pager)&&o.viewport.after(o.controls.el)),g(e,h)},g=function(e,i){var s=e.find("img, iframe").length;if(0==s)return i(),void 0;var n=0;e.find("img, iframe").each(function(){t(this).one("load",function(){++n==s&&i()}).each(function(){this.complete&&t(this).load()})})},h=function(){if(o.settings.infiniteloop&&"fade"!=o.settings.mode&&!o.settings.ticker){var e="vertical"==o.settings.mode?o.settings.minslides:o.settings.maxslides,i=o.children.slice(0,e).clone().addclass("bx-clone"),s=o.children.slice(-e).clone().addclass("bx-clone");r.append(i).prepend(s)}o.loader.remove(),s(),"vertical"==o.settings.mode&&(o.settings.adaptiveheight=!0),o.viewport.height(v()),r.redrawslider(),o.settings.onsliderload(o.active.index),o.initialized=!0,o.settings.responsive&&t(window).bind("resize",z),o.settings.auto&&o.settings.autostart&&h(),o.settings.ticker&&l(),o.settings.pager&&q(o.settings.startslide),o.settings.controls&&w(),o.settings.touchenabled&&!o.settings.ticker&&o()},v=function(){var e=0,s=t();if("vertical"==o.settings.mode||o.settings.adaptiveheight)if(o.carousel){var n=1==o.settings.moveslides?o.active.index:o.active.index*m();for(s=o.children.eq(n),i=1;i<=o.settings.maxslides-1;i++)s=n+i>=o.children.length?s.add(o.children.eq(i-1)):s.add(o.children.eq(n+i))}else s=o.children.eq(o.active.index);else s=o.children;return"vertical"==o.settings.mode?(s.each(function(){e+=t(this).outerheight()}),o.settings.slidemargin>0&&(e+=o.settings.slidemargin*(o.settings.minslides-1))):e=math.max.apply(math,s.map(function(){return t(this).outerheight(!1)}).get()),e},p=function(){var t="100%";return o.settings.slidewidth>0&&(t="horizontal"==o.settings.mode?o.settings.maxslides*o.settings.slidewidth+(o.settings.maxslides-1)*o.settings.slidemargin:o.settings.slidewidth),t},u=function(){var t=o.settings.slidewidth,e=o.viewport.width();return 0==o.settings.slidewidth||o.settings.slidewidth>e&&!o.carousel||"vertical"==o.settings.mode?t=e:o.settings.maxslides>1&&"horizontal"==o.settings.mode&&(e>o.maxthreshold||e0)if(o.viewport.width()o.maxthreshold)t=o.settings.maxslides;else{var e=o.children.first().width();t=math.floor(o.viewport.width()/e)}else"vertical"==o.settings.mode&&(t=o.settings.minslides);return t},x=function(){var t=0;if(o.settings.moveslides>0)if(o.settings.infiniteloop)t=o.children.length/m();else for(var e=0,i=0;e0&&o.settings.moveslides<=f()?o.settings.moveslides:f()},s=function(){if(o.children.length>o.settings.maxslides&&o.active.last&&!o.settings.infiniteloop){if("horizontal"==o.settings.mode){var t=o.children.last(),e=t.position();b(-(e.left-(o.viewport.width()-t.width())),"reset",0)}else if("vertical"==o.settings.mode){var i=o.children.length-o.settings.minslides,e=o.children.eq(i).position();b(-e.top,"reset",0)}}else{var e=o.children.eq(o.active.index*m()).position();o.active.index==x()-1&&(o.active.last=!0),void 0!=e&&("horizontal"==o.settings.mode?b(-e.left,"reset",0):"vertical"==o.settings.mode&&b(-e.top,"reset",0))}},b=function(t,e,i,s){if(o.usingcss){var n="vertical"==o.settings.mode?"translate3d(0, "+t+"px, 0)":"translate3d("+t+"px, 0, 0)";r.css("-"+o.cssprefix+"-transition-duration",i/1e3+"s"),"slide"==e?(r.css(o.animprop,n),r.bind("transitionend webkittransitionend otransitionend mstransitionend",function(){r.unbind("transitionend webkittransitionend otransitionend mstransitionend"),d()})):"reset"==e?r.css(o.animprop,n):"ticker"==e&&(r.css("-"+o.cssprefix+"-transition-timing-function","linear"),r.css(o.animprop,n),r.bind("transitionend webkittransitionend otransitionend mstransitionend",function(){r.unbind("transitionend webkittransitionend otransitionend mstransitionend"),b(s.resetvalue,"reset",0),n()}))}else{var a={};a[o.animprop]=t,"slide"==e?r.animate(a,i,o.settings.easing,function(){d()}):"reset"==e?r.css(o.animprop,t):"ticker"==e&&r.animate(a,speed,"linear",function(){b(s.resetvalue,"reset",0),n()})}},w=function(){for(var e="",i=x(),s=0;i>s;s++){var n="";o.settings.buildpager&&t.isfunction(o.settings.buildpager)?(n=o.settings.buildpager(s),o.pagerel.addclass("bx-custom-pager")):(n=s+1,o.pagerel.addclass("bx-default-pager")),e+='"}o.pagerel.html(e)},t=function(){o.settings.pagercustom?o.pagerel=t(o.settings.pagercustom):(o.pagerel=t('
'),o.settings.pagerselector?t(o.settings.pagerselector).html(o.pagerel):o.controls.el.addclass("bx-has-pager").append(o.pagerel),w()),o.pagerel.on("click","a",i)},c=function(){o.controls.next=t(''+o.settings.nexttext+""),o.controls.prev=t(''+o.settings.prevtext+""),o.controls.next.bind("click",y),o.controls.prev.bind("click",z),o.settings.nextselector&&t(o.settings.nextselector).append(o.controls.next),o.settings.prevselector&&t(o.settings.prevselector).append(o.controls.prev),o.settings.nextselector||o.settings.prevselector||(o.controls.directionel=t('
'),o.controls.directionel.append(o.controls.prev).append(o.controls.next),o.controls.el.addclass("bx-has-controls-direction").append(o.controls.directionel))},e=function(){o.controls.start=t('"),o.controls.stop=t('"),o.controls.autoel=t('
'),o.controls.autoel.on("click",".bx-start",k),o.controls.autoel.on("click",".bx-stop",m),o.settings.autocontrolscombine?o.controls.autoel.append(o.controls.start):o.controls.autoel.append(o.controls.start).append(o.controls.stop),o.settings.autocontrolsselector?t(o.settings.autocontrolsselector).html(o.controls.autoel):o.controls.el.addclass("bx-has-controls-auto").append(o.controls.autoel),a(o.settings.autostart?"stop":"start")},p=function(){o.children.each(function(){var e=t(this).find("img:first").attr("title");void 0!=e&&(""+e).length&&t(this).append('
'+e+"
")})},y=function(t){o.settings.auto&&r.stopauto(),r.gotonextslide(),t.preventdefault()},z=function(t){o.settings.auto&&r.stopauto(),r.gotoprevslide(),t.preventdefault()},k=function(t){r.startauto(),t.preventdefault()},m=function(t){r.stopauto(),t.preventdefault()},i=function(e){o.settings.auto&&r.stopauto();var i=t(e.currenttarget),s=parseint(i.attr("data-slide-index"));s!=o.active.index&&r.gotoslide(s),e.preventdefault()},q=function(e){var i=o.children.length;return"short"==o.settings.pagertype?(o.settings.maxslides>1&&(i=math.ceil(o.children.length/o.settings.maxslides)),o.pagerel.html(e+1+o.settings.pagershortseparator+i),void 0):(o.pagerel.find("a").removeclass("active"),o.pagerel.each(function(i,s){t(s).find("a").eq(e).addclass("active")}),void 0)},d=function(){if(o.settings.infiniteloop){var t="";0==o.active.index?t=o.children.eq(0).position():o.active.index==x()-1&&o.carousel?t=o.children.eq((x()-1)*m()).position():o.active.index==o.children.length-1&&(t=o.children.eq(o.children.length-1).position()),t&&("horizontal"==o.settings.mode?b(-t.left,"reset",0):"vertical"==o.settings.mode&&b(-t.top,"reset",0))}o.working=!1,o.settings.onslideafter(o.children.eq(o.active.index),o.oldindex,o.active.index)},a=function(t){o.settings.autocontrolscombine?o.controls.autoel.html(o.controls[t]):(o.controls.autoel.find("a").removeclass("active"),o.controls.autoel.find("a:not(.bx-"+t+")").addclass("active"))},w=function(){1==x()?(o.controls.prev.addclass("disabled"),o.controls.next.addclass("disabled")):!o.settings.infiniteloop&&o.settings.hidecontrolonend&&(0==o.active.index?(o.controls.prev.addclass("disabled"),o.controls.next.removeclass("disabled")):o.active.index==x()-1?(o.controls.next.addclass("disabled"),o.controls.prev.removeclass("disabled")):(o.controls.prev.removeclass("disabled"),o.controls.next.removeclass("disabled")))},h=function(){o.settings.autodelay>0?settimeout(r.startauto,o.settings.autodelay):r.startauto(),o.settings.autohover&&r.hover(function(){o.interval&&(r.stopauto(!0),o.autopaused=!0)},function(){o.autopaused&&(r.startauto(!0),o.autopaused=null)})},l=function(){var e=0;if("next"==o.settings.autodirection)r.append(o.children.clone().addclass("bx-clone"));else{r.prepend(o.children.clone().addclass("bx-clone"));var i=o.children.first().position();e="horizontal"==o.settings.mode?-i.left:-i.top}b(e,"reset",0),o.settings.pager=!1,o.settings.controls=!1,o.settings.autocontrols=!1,o.settings.tickerhover&&!o.usingcss&&o.viewport.hover(function(){r.stop()},function(){var e=0;o.children.each(function(){e+="horizontal"==o.settings.mode?t(this).outerwidth(!0):t(this).outerheight(!0)});var i=o.settings.speed/e,s="horizontal"==o.settings.mode?"left":"top",n=i*(e-math.abs(parseint(r.css(s))));n(n)}),n()},n=function(t){speed=t?t:o.settings.speed;var e={left:0,top:0},i={left:0,top:0};"next"==o.settings.autodirection?e=r.find(".bx-clone").first().position():i=o.children.first().position();var s="horizontal"==o.settings.mode?-e.left:-e.top,n="horizontal"==o.settings.mode?-i.left:-i.top,a={resetvalue:n};b(s,"ticker",speed,a)},o=function(){o.touch={start:{x:0,y:0},end:{x:0,y:0}},o.viewport.bind("touchstart",x)},x=function(t){if(o.working)t.preventdefault();else{o.touch.originalpos=r.position();var e=t.originalevent;o.touch.start.x=e.changedtouches[0].pagex,o.touch.start.y=e.changedtouches[0].pagey,o.viewport.bind("touchmove",y),o.viewport.bind("touchend",v)}},y=function(t){var e=t.originalevent,i=math.abs(e.changedtouches[0].pagex-o.touch.start.x),s=math.abs(e.changedtouches[0].pagey-o.touch.start.y);if(3*i>s&&o.settings.preventdefaultswipex?t.preventdefault():3*s>i&&o.settings.preventdefaultswipey&&t.preventdefault(),"fade"!=o.settings.mode&&o.settings.onetoonetouch){var n=0;if("horizontal"==o.settings.mode){var r=e.changedtouches[0].pagex-o.touch.start.x;n=o.touch.originalpos.left+r}else{var r=e.changedtouches[0].pagey-o.touch.start.y;n=o.touch.originalpos.top+r}b(n,"reset",0)}},v=function(t){o.viewport.unbind("touchmove",y);var e=t.originalevent,i=0;if(o.touch.end.x=e.changedtouches[0].pagex,o.touch.end.y=e.changedtouches[0].pagey,"fade"==o.settings.mode){var s=math.abs(o.touch.start.x-o.touch.end.x);s>=o.settings.swipethreshold&&(o.touch.start.x>o.touch.end.x?r.gotonextslide():r.gotoprevslide(),r.stopauto())}else{var s=0;"horizontal"==o.settings.mode?(s=o.touch.end.x-o.touch.start.x,i=o.touch.originalpos.left):(s=o.touch.end.y-o.touch.start.y,i=o.touch.originalpos.top),!o.settings.infiniteloop&&(0==o.active.index&&s>0||o.active.last&&0>s)?b(i,"reset",200):math.abs(s)>=o.settings.swipethreshold?(0>s?r.gotonextslide():r.gotoprevslide(),r.stopauto()):b(i,"reset",200)}o.viewport.unbind("touchend",v)},z=function(){var e=t(window).width(),i=t(window).height();(a!=e||l!=i)&&(a=e,l=i,r.redrawslider(),o.settings.onsliderresize.call(r,o.active.index))};return r.gotoslide=function(e,i){if(!o.working&&o.active.index!=e)if(o.working=!0,o.oldindex=o.active.index,o.active.index=0>e?x()-1:e>=x()?0:e,o.settings.onslidebefore(o.children.eq(o.active.index),o.oldindex,o.active.index),"next"==i?o.settings.onslidenext(o.children.eq(o.active.index),o.oldindex,o.active.index):"prev"==i&&o.settings.onslideprev(o.children.eq(o.active.index),o.oldindex,o.active.index),o.active.last=o.active.index>=x()-1,o.settings.pager&&q(o.active.index),o.settings.controls&&w(),"fade"==o.settings.mode)o.settings.adaptiveheight&&o.viewport.height()!=v()&&o.viewport.animate({height:v()},o.settings.adaptiveheightspeed),o.children.filter(":visible").fadeout(o.settings.speed).css({zindex:0}),o.children.eq(o.active.index).css("zindex",o.settings.slidezindex+1).fadein(o.settings.speed,function(){t(this).css("zindex",o.settings.slidezindex),d()});else{o.settings.adaptiveheight&&o.viewport.height()!=v()&&o.viewport.animate({height:v()},o.settings.adaptiveheightspeed);var s=0,n={left:0,top:0};if(!o.settings.infiniteloop&&o.carousel&&o.active.last)if("horizontal"==o.settings.mode){var a=o.children.eq(o.children.length-1);n=a.position(),s=o.viewport.width()-a.outerwidth()}else{var l=o.children.length-o.settings.minslides;n=o.children.eq(l).position()}else if(o.carousel&&o.active.last&&"prev"==i){var d=1==o.settings.moveslides?o.settings.maxslides-m():(x()-1)*m()-(o.children.length-o.settings.maxslides),a=r.children(".bx-clone").eq(d);n=a.position()}else if("next"==i&&0==o.active.index)n=r.find("> .bx-clone").eq(o.settings.maxslides).position(),o.active.last=!1;else if(e>=0){var c=e*m();n=o.children.eq(c).position()}if("undefined"!=typeof n){var g="horizontal"==o.settings.mode?-(n.left-s):-n.top;b(g,"slide",o.settings.speed)}}},r.gotonextslide=function(){if(o.settings.infiniteloop||!o.active.last){var t=parseint(o.active.index)+1;r.gotoslide(t,"next")}},r.gotoprevslide=function(){if(o.settings.infiniteloop||0!=o.active.index){var t=parseint(o.active.index)-1;r.gotoslide(t,"prev")}},r.startauto=function(t){o.interval||(o.interval=setinterval(function(){"next"==o.settings.autodirection?r.gotonextslide():r.gotoprevslide()},o.settings.pause),o.settings.autocontrols&&1!=t&&a("stop"))},r.stopauto=function(t){o.interval&&(clearinterval(o.interval),o.interval=null,o.settings.autocontrols&&1!=t&&a("start"))},r.getcurrentslide=function(){return o.active.index},r.getcurrentslideelement=function(){return o.children.eq(o.active.index)},r.getslidecount=function(){return o.children.length},r.redrawslider=function(){o.children.add(r.find(".bx-clone")).outerwidth(u()),o.viewport.css("height",v()),o.settings.ticker||s(),o.active.last&&(o.active.index=x()-1),o.active.index>=x()&&(o.active.last=!0),o.settings.pager&&!o.settings.pagercustom&&(w(),q(o.active.index))},r.destroyslider=function(){o.initialized&&(o.initialized=!1,t(".bx-clone",this).remove(),o.children.each(function(){void 0!=t(this).data("origstyle")?t(this).attr("style",t(this).data("origstyle")):t(this).removeattr("style")}),void 0!=t(this).data("origstyle")?this.attr("style",t(this).data("origstyle")):t(this).removeattr("style"),t(this).unwrap().unwrap(),o.controls.el&&o.controls.el.remove(),o.controls.next&&o.controls.next.remove(),o.controls.prev&&o.controls.prev.remove(),o.pagerel&&o.settings.controls&&o.pagerel.remove(),t(".bx-caption",this).remove(),o.controls.autoel&&o.controls.autoel.remove(),clearinterval(o.interval),o.settings.responsive&&t(window).unbind("resize",z))},r.reloadslider=function(t){void 0!=t&&(n=t),r.destroyslider(),d()},d(),this}}(jquery);