/*! modernizr 3.0.0 (Custom Build) | MIT * * http://modernizr.com/download/?-csstransforms-csstransforms3d !*/ !function(e,n,t){function r(e,n){return typeof e===n}function o(){var e,n,t,o,s,i,f;for(var a in y){if(e=[],n=y[a],n.name&&(e.push(n.name.toLowerCase()),n.options&&n.options.aliases&&n.options.aliases.length))for(t=0;tc;c++)if(v=e[c],h=k.style[v],a(v,"-")&&(v=u(v)),k.style[v]!==t){if(i||r(o,"undefined"))return f(),"pfx"==n?v:!0;try{k.style[v]=o}catch(g){}if(k.style[v]!=h)return f(),"pfx"==n?v:!0}return f(),!1}function c(e,n){return function(){return e.apply(n,arguments)}}function m(e,n,t){var o;for(var s in e)if(e[s]in n)return t===!1?e[s]:(o=n[e[s]],r(o,"function")?c(o,t||n):o);return!1}function v(e,n,t,o,s){var i=e.charAt(0).toUpperCase()+e.slice(1),f=(e+" "+P.join(i+" ")+i).split(" ");return r(n,"string")||r(n,"undefined")?d(f,n,o,s):(f=(e+" "+T.join(i+" ")+i).split(" "),m(f,n,t))}function h(e,n,r){return v(e,t,t,n,r)}var y=[],g={_version:"3.0.0",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,n){var t=this;setTimeout(function(){n(t[e])},0)},addTest:function(e,n,t){y.push({name:e,fn:n,options:t})},addAsyncTest:function(e){y.push({name:null,fn:e})}},Modernizr=function(){};Modernizr.prototype=g,Modernizr=new Modernizr;var C=[],S=n.documentElement,w="CSS"in e&&"supports"in e.CSS,x="supportsCSS"in e;Modernizr.addTest("supports",w||x);var _="svg"===S.nodeName.toLowerCase(),b=g.testStyles=f,z="Moz O ms Webkit",P=g._config.usePrefixes?z.split(" "):[];g._cssomPrefixes=P;var T=g._config.usePrefixes?z.toLowerCase().split(" "):[];g._domPrefixes=T;var E={elem:s("modernizr")};Modernizr._q.push(function(){delete E.elem});var k={style:E.elem.style};Modernizr._q.unshift(function(){delete k.style}),g.testAllProps=v,g.testAllProps=h,Modernizr.addTest("csstransforms3d",function(){var e=!!h("perspective","1px",!0),n=Modernizr._config.usePrefixes;if(e&&(!n||"webkitPerspective"in S.style)){var t;Modernizr.supports?t="@supports (perspective: 1px)":(t="@media (transform-3d)",n&&(t+=",(-webkit-transform-3d)")),t+="{#modernizr{left:9px;position:absolute;height:5px;margin:0;padding:0;border:0}}",b(t,function(n){e=9===n.offsetLeft&&5===n.offsetHeight})}return e}),Modernizr.addTest("csstransforms",function(){return-1===navigator.userAgent.indexOf("Android 2.")&&h("transform","scale(1)",!0)}),o(),delete g.addTest,delete g.addAsyncTest;for(var A=0;A 0) { _self._navigate('next', 'dg-transition-fast'); toMove--; } else if (toMove < 0) { _self._navigate('prev', 'dg-transition-fast'); toMove++; } } }, 0); break; } }); } }, // 鑷€傚簲瀹藉害 _updateWidth: function () { if (this.support3d) { if (document.body.clientWidth < 1300) { this.CSSX = ($(this.box).width() - 10 - this.imgWidth * 0.7*3.5) / 2; this.CSSXout = 0; } else if (document.body.clientWidth >= 1300) { this.CSSX = ($(this.box).width() * 1.2 - 10 - this.imgWidth * 0.5*3.5) / 2 * 0.5; this.CSSXout = ($(this.box).width() * 1.2 - 10 - this.imgWidth * 0.5*3.5) / 2; } } else if (this.support2d) { if (document.body.clientWidth < 1464) { this.CSSX = ($(this.box).width() - 10 - this.imgWidth * 0.7*3.5) / 2; this.CSSXout = 0; } else if (document.body.clientWidth >= 1464) { this.CSSX = (($(this.box).width() - 10 - this.imgWidth * 0.4*3.5) / 2) * 0.7; this.CSSXout = ($(this.box).width() - 10 - this.imgWidth * 0.4*3.5) / 2; } } }, // 鏄剧ず灏忓渾鐐 _showButton: function () { var _self = this; for (var i = 0, len = _self.button.length; i < len; i++) { if (_self.button[i].classList.contains('light')) { _self.button[i].classList.remove('light'); break; } } _self.button[_self.indexB].classList.add('light'); }, // 鐢ㄦ潵缁戝畾鐐瑰嚮浜嬩欢 _click: function (element, move) { var _self = this; element.off('click.gallery'); element.on('click.gallery', function () { if (!this.isAnim) { _self._navigate(move); if (_self.options.autoplay) { _self._startSlideshow(); } } }); }, // 鍒濆鏍峰紡 _layout: function () { this._setItems(); this.$leftItm.css(this._getCoordinates('left')); this.$rightItm.css(this._getCoordinates('right')); this.$currentItm.css(this._getCoordinates('center')).addClass('dg-center'); this._click(this.$leftItm, 'prev'); this._click(this.$prevItm, 'prev'); this.$currentItm.off('click.carrousel'); this._click(this.$rightItm, 'next'); this._click(this.$nextItm, 'next'); this.$nextItm.css(this._getCoordinates('outright')); this.$prevItm.css(this._getCoordinates('outleft')); //this.$currentItm[0].href = this.$currentItm[0].getAttribute('link'); }, // 鏇存柊鍥剧墖浣嶇疆 _setItems: function () { this.$items.removeClass('dg-center'); this.$currentItm = this.$items.eq(this.current); this.$leftItm = ( this.current === 0 ) ? this.$items.eq(this.itemsCount - 1) : this.$items.eq(this.current - 1); this.$rightItm = ( this.current === this.itemsCount - 1 ) ? this.$items.eq(0) : this.$items.eq(this.current + 1); this.$nextItm = ( this.$rightItm.index() === this.itemsCount - 1 ) ? this.$items.eq(0) : this.$rightItm.next(); this.$prevItm = ( this.$leftItm.index() === 0 ) ? this.$items.eq(this.itemsCount - 1) : this.$leftItm.prev(); }, _loadEvents: function () { var _self = this; this.$navPrev.on('click.carrousel', function () { _self._navigate('prev'); return false; }); this.$navNext.on('click.carrousel', function () { _self._navigate('next'); return false; }); this.$wrapper.on('webkitTransitionEnd.carrousel transitionend.carrousel OTransitionEnd.carrousel', function () { _self.$currentItm.addClass('dg-center'); _self.$items.removeClass('dg-transition'); _self.$items.removeClass('dg-transition-fast'); _self.isAnim = false; // 澶勭悊涓棿鍏冪礌鐨刪ref //_self.$currentItm[0].href = _self.$currentItm[0].getAttribute('link'); //_self.$leftItm[0].href = '#'; //_self.$rightItm[0].href = '#'; // 澶勭悊宸﹀彸鍏冪礌鐨勭偣鍑讳簨浠 _self._click(_self.$leftItm, 'prev'); _self._click(_self.$prevItm, 'prev'); _self.$currentItm.off('click.gallery'); _self._click(_self.$rightItm, 'next'); _self._click(_self.$nextItm, 'next'); }); }, // 瀹氫箟鏍峰紡 _getCoordinates: function (position) { if (this.support3d) { switch (position) { case 'outleft': return { '-webkit-transform': 'translateX(-' + this.CSSXout + 'px) translateZ(-560px) rotateY(0deg)', '-moz-transform': 'translateX(-' + this.CSSXout + 'px) translateZ(-560px) rotateY(0deg)', '-o-transform': 'translateX(-' + this.CSSXout + 'px) translateZ(-560px) rotateY(0deg)', '-ms-transform': 'translateX(-' + this.CSSXout + 'px) translateZ(-560px) rotateY(0deg)', 'transform': 'translateX(-' + this.CSSXout + 'px) translateZ(-560px) rotateY(0deg)', 'opacity': 1, 'z-index': 2 }; break; case 'outright': return { '-webkit-transform': 'translateX(' + this.CSSXout + 'px) translateZ(-560px) rotateY(0deg)', '-moz-transform': 'translateX(' + this.CSSXout + 'px) translateZ(-560px) rotateY(0deg)', '-o-transform': 'translateX(' + this.CSSXout + 'px) translateZ(-560px) rotateY(0deg)', '-ms-transform': 'translateX(' + this.CSSXout + 'px) translateZ(-560px) rotateY(0deg)', 'transform': 'translateX(' + this.CSSXout + 'px) translateZ(-560px) rotateY(0deg)', 'opacity': 1, 'z-index': 2 }; break; case 'left': return { '-webkit-transform': 'translateX(-' + this.CSSX + 'px) translateZ(-300px) rotateY(0deg)', '-moz-transform': 'translateX(-' + this.CSSX + 'px) translateZ(-300px) rotateY(0deg)', '-o-transform': 'translateX(-' + this.CSSX + 'px) translateZ(-300px) rotateY(0deg)', '-ms-transform': 'translateX(-' + this.CSSX + 'px) translateZ(-300px) rotateY(0deg)', 'transform': 'translateX(-' + this.CSSX + 'px) translateZ(-300px) rotateY(0deg)', 'opacity': 1, 'z-index': 3, 'visibility': 'visible' }; break; case 'right': return { '-webkit-transform': 'translateX(' + this.CSSX + 'px) translateZ(-300px) rotateY(0deg)', '-moz-transform': 'translateX(' + this.CSSX + 'px) translateZ(-300px) rotateY(0deg)', '-o-transform': 'translateX(' + this.CSSX + 'px) translateZ(-300px) rotateY(0deg)', '-ms-transform': 'translateX(' + this.CSSX + 'px) translateZ(-300px) rotateY(0deg)', 'transform': 'translateX(' + this.CSSX + 'px) translateZ(-300px) rotateY(0deg)', 'opacity': 1, 'z-index': 3, 'visibility': 'visible' }; break; case 'center': return { '-webkit-transform': 'translateX(0px) translateZ(0px) rotateY(0deg)', '-moz-transform': 'translateX(0px) translateZ(0px) rotateY(0deg)', '-o-transform': 'translateX(0px) translateZ(0px) rotateY(0deg)', '-ms-transform': 'translateX(0px) translateZ(0px) rotateY(0deg)', 'transform': 'translateX(0px) translateZ(0px) rotateY(0deg)', 'opacity': 1, 'z-index': 4, 'visibility': 'visible' }; break; case 'hide': return { '-webkit-transform': 'translate(0px) scale(0.7)', 'opacity': 1, 'visibility': 'visible', 'z-index': 1 }; break; } } else if (this.support2d) { switch (position) { case 'outleft': return { '-webkit-transform': 'translate(-' + this.CSSXout + 'px) scale(0.8)', '-moz-transform': 'translate(-' + this.CSSXout + 'px) scale(0.8)', '-o-transform': 'translate(-' + this.CSSXout + 'px) scale(0.8)', '-ms-transform': 'translate(-' + this.CSSXout + 'px) scale(0.8)', 'transform': 'translate(-' + this.CSSXout + 'px) scale(0.8)', 'opacity': 1, 'z-index': 2 }; break; case 'outright': return { '-webkit-transform': 'translate(' + this.CSSXout + 'px) scale(0.8)', '-moz-transform': 'translate(' + this.CSSXout + 'px) scale(0.8)', '-o-transform': 'translate(' + this.CSSXout + 'px) scale(0.8)', '-ms-transform': 'translate(' + this.CSSXout + 'px) scale(0.8)', 'transform': 'translate(' + this.CSSXout + 'px) scale(0.8)', 'opacity': 1, 'z-index': 2 }; break; case 'left': return { '-webkit-transform': 'translate(-' + this.CSSX + 'px) scale(0.9)', '-moz-transform': 'translate(-' + this.CSSX + 'px) scale(0.9)', '-o-transform': 'translate(-' + this.CSSX + 'px) scale(0.9)', '-ms-transform': 'translate(-' + this.CSSX + 'px) scale(0.9)', 'transform': 'translate(-' + this.CSSX + 'px) scale(0.9)', 'opacity': 1, 'visibility': 'visible', 'z-index': 3 }; break; case 'right': return { '-webkit-transform': 'translate(' + this.CSSX + 'px) scale(0.9)', '-moz-transform': 'translate(' + this.CSSX + 'px) scale(0.9)', '-o-transform': 'translate(' + this.CSSX + 'px) scale(0.9)', '-ms-transform': 'translate(' + this.CSSX + 'px) scale(0.9)', 'transform': 'translate(' + this.CSSX + 'px) scale(0.9)', 'opacity': 1, 'visibility': 'visible', 'z-index': 3 }; break; case 'center': return { '-webkit-transform': 'translate(0px) scale(1)', '-moz-transform': 'translate(0px) scale(1)', '-o-transform': 'translate(0px) scale(1)', '-ms-transform': 'translate(0px) scale(1)', 'transform': 'translate(0px) scale(1)', 'opacity': 1, 'visibility': 'visible', 'z-index': 4 }; case 'hide': return { '-webkit-transform': 'translate(0px) scale(0.7)', '-moz-transform': 'translate(0px) scale(0.7)', '-o-transform': 'translate(0px) scale(0.7)', '-ms-transform': 'translate(0px) scale(0.7)', 'transform': 'translate(0px) scale(0.7)', 'opacity': 1, 'visibility': 'visible', 'z-index': 1 } break; } } }, // 鍒囨崲 _navigate: function (dir, speedClass) { speedClass = speedClass || 'dg-transition'; if (!this.isAnim) { this._updateWidth(); this.isAnim = true; var _self = this; switch (dir) { case 'next' : this.indexB++; if (this.indexB === this.itemsCount) { this.indexB = 0; } this._showButton(); this.current = this.$rightItm.index(); // current item moves left this.$currentItm.addClass(speedClass).css(this._getCoordinates('left')); // right item moves to the center this.$rightItm.addClass(speedClass).css(this._getCoordinates('center')); // left item moves out this.$leftItm.addClass(speedClass).css(this._getCoordinates('outleft')); this.$nextItm.addClass(speedClass).css(this._getCoordinates('right')); if (this.itemsCount > 5) { this.$prevItm.addClass(speedClass).css(this._getCoordinates('hide')); this.$prevItm.off('click.carrousel'); } var nextEle = ( this.$nextItm.index() === this.itemsCount - 1 ) ? this.$items.eq(0) : this.$nextItm.next(); $(nextEle).addClass(speedClass).css(this._getCoordinates('outright')); $(nextEle).off('click.carrousel'); break; case 'prev' : this.indexB--; if (this.indexB === -1) { this.indexB = this.itemsCount - 1; } this._showButton(); this.current = this.$leftItm.index(); // current item moves right this.$currentItm.addClass(speedClass).css(this._getCoordinates('right')); // left item moves to the center this.$leftItm.addClass(speedClass).css(this._getCoordinates('center')); // right item moves out this.$rightItm.addClass(speedClass).css(this._getCoordinates('outright')); this.$prevItm.addClass(speedClass).css(this._getCoordinates('left')); if (this.itemsCount > 5) { this.$nextItm.addClass(speedClass).css(this._getCoordinates('hide')); this.$nextItm.off('click.carrousel'); } var prevEle = ( this.$prevItm.index() === 0 ) ? this.$items.eq(this.itemsCount - 1) : this.$prevItm.prev(); $(prevEle).addClass(speedClass).css(this._getCoordinates('outleft')); $(prevEle).off('click.carrousel'); break; } ; this._setItems(); } }, // 鑷姩鍒囨崲 _startSlideshow: function () { if (this.slideshow) { clearInterval(this.slideshow); } var _self = this; this.slideshow = setInterval(function () { if ($('.dg-center')[0] && !_self.isAnim) { _self._navigate('next'); } }, this.options.interval); }, _stopSlideshow: function () { clearTimeout(this.slideshow); } }; $.fn.carrousel = function (options) { if (typeof options === 'object') { this.each(function () { var instance = $.data(this, 'carrousel'); if (!instance) { $.data(this, 'carrousel', new $.carrousel(options, this)); } }); } else if (typeof options === 'string') { this.each(function () { var instance = $.data(this, 'carrousel'); if (instance) { switch (options) { case 'play': instance._startSlideshow(); instance.options.autoplay = true; break; case 'stop': instance._stopSlideshow(); instance.options.autoplay = false; break; case 'next': instance._navigate('next'); break; case 'prev': instance._navigate('prev'); break; } } }); } else if (typeof options === 'number') { this.each(function () { var instance = $.data(this, 'carrousel'); instance.button[options].click(); }); } return this; }; })(jQuery);