! 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; t < n.options.aliases.length; t++) e.push(n.options.aliases[t].tolowercase()); for(o = r(n.fn, "function") ? n.fn() : n.fn, s = 0; s < e.length; s++) i = e[s], f = i.split("."), 1 === f.length ? modernizr[f[0]] = o : (!modernizr[f[0]] || modernizr[f[0]] instanceof boolean || (modernizr[f[0]] = new boolean(modernizr[f[0]])), modernizr[f[0]][f[1]] = o), c.push((o ? "" : "no-") + f.join("-")) } } function s() { return "function" != typeof n.createelement ? n.createelement(arguments[0]) : _ ? n.createelementns.call(n, "http://www.w3.org/2000/svg", arguments[0]) : n.createelement.apply(n, arguments) } function i() { var e = n.body; return e || (e = s(_ ? "svg" : "body"), e.fake = !0), e } function f(e, t, r, o) { var f, a, u, l, p = "modernizr", d = s("div"), c = i(); if(parseint(r, 10)) for(; r--;) u = s("div"), u.id = o ? o[r] : p + (r + 1), d.appendchild(u); return f = s("style"), f.type = "text/css", f.id = "s" + p, (c.fake ? c : d).appendchild(f), c.appendchild(d), f.stylesheet ? f.stylesheet.csstext = e : f.appendchild(n.createtextnode(e)), d.id = p, c.fake && (c.style.background = "", c.style.overflow = "hidden", l = s.style.overflow, s.style.overflow = "hidden", s.appendchild(c)), a = t(d, e), c.fake ? (c.parentnode.removechild(c), s.style.overflow = l, s.offsetheight) : d.parentnode.removechild(d), !!a } function a(e, n) { return !!~("" + e).indexof(n) } function u(e) { return e.replace(/([a-z])-([a-z])/g, function(e, n, t) { return n + t.touppercase() }).replace(/^-/, "") } function l(e) { return e.replace(/([a-z])/g, function(e, n) { return "-" + n.tolowercase() }).replace(/^ms-/, "-ms-") } function p(n, r) { var o = n.length; if("css" in e && "supports" in e.css) { for(; o--;) if(e.css.supports(l(n[o]), r)) return !0; return !1 } if("csssupportsrule" in e) { for(var s = []; o--;) s.push("(" + l(n[o]) + ":" + r + ")"); return s = s.join(" or "), f("@supports (" + s + ") { #modernizr { position: absolute; } }", function(e) { return "absolute" == getcomputedstyle(e, null).position }) } return t } function d(e, n, o, i) { function f() { d && (delete k.style, delete k.modelem) } if(i = r(i, "undefined") ? !1 : i, !r(o, "undefined")) { var l = p(e, o); if(!r(l, "undefined")) return l } for(var d, c, m, v, h, y = ["modernizr", "tspan"]; !k.style;) d = !0, k.modelem = s(y.shift()), k.style = k.modelem.style; for(m = e.length, c = 0; m > c; 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 < modernizr._q.length; a++) modernizr._q[a](); e.modernizr = modernizr }(window, document); (function($) { $.carrousel = function(options, element) { this.$el = $(element); this._init(options); }; $.carrousel.defaults = { current: 0, // index of current item autoplay: true, // slideshow on / off interval: 3000 // time between transitions }; $.carrousel.prototype = { // 鍒濆鍖? _init: function(options) { this.options = $.extend(true, {}, $.carrousel.defaults, options); this.support3d = modernizr.csstransforms3d; this.support2d = modernizr.csstransforms; this.$wrapper = this.$el.find('.dg-wrapper'); this.$items = this.$wrapper.children(); this.itemscount = this.$items.length; this.$nav = this.$el.find('nav'); this.$navprev = this.$nav.find('.dg-prev'); this.$navnext = this.$nav.find('.dg-next'); this.button = $('#lightbutton li'); this.box = $('.banner'); this.imgwidth = $('.banner .dg-wrapper img').width(); this.indexb = 0; this.cssx = 0; this.cssxout = 0; this.button[0].classlist.add('light'); this.current = this.options.current; this.isanim = false; this.$items.css({ 'opacity': 1 }); this._updatewidth(); this._layout(); // load the events this._loadevents(); // slideshow if(this.options.autoplay) { this._startslideshow(); } var _self = this; for(var i = 0, len = this.button.length; i < len; i++) { // 鐐瑰嚮灏忓渾鐐? this.button[i].addeventlistener('click', function() { var toindex = parseint(this.getattribute('index')); var tomove = toindex - _self.indexb; switch(tomove) { case 0: break; case 1: _self._navigate('next', 'dg-transition'); break; case -1: _self._navigate('prev', 'dg-transition'); break; default: _self._stopslideshow(); var btime = setinterval(function() { if(!_self.isanim) { if(!tomove) { clearinterval(btime); if(_self.options.autoplay) { _self._startslideshow(); } } else if(tomove > 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) / 2; this.cssxout = 0; }*/ /*else if (document.body.clientwidth >= 1300) {*/ this.cssx = ($(this.box).width() * 1.2 - 10 - this.imgwidth * 0.5) / 2 * 0.5; this.cssxout = ($(this.box).width() * 1.2 - 10 - this.imgwidth * 0.5) / 2; /*}*/ } /*else if (this.support2d) { if (document.body.clientwidth < 1464) { this.cssx = ($(this.box).width() - 10 - this.imgwidth * 0.9) / 2; this.cssxout = 0; } else if (document.body.clientwidth >= 1464) { this.cssx = (($(this.box).width() - 10 - this.imgwidth * 0.8) / 2) * 0.7; this.cssxout = ($(this.box).width() - 10 - this.imgwidth * 0.8) / 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.prev("a").css("z-index",1); //this.$leftitm.css("z-index",1); this.$leftitm.css(this._getcoordinates('left')); this.$rightitm.css(this._getcoordinates('right')); //this.$rightitm.css("z-index",1); //this.$rightitm.next("a").css("z-index",1); 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].getattribute('link') this.$currentitm[0].href ="javascript:void(0)"; //console.log(1); if(window.activexobject || "activexobject" in window && this.$currentitm.index() == 0) { this.$currentitm.next("a").css("z-index", 20); } }, // 鏇存柊鍥剧墖浣嶇疆 _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 ="javascript:void(0)"; //console.log(_self.$currentitm[0].getattribute('link')) _self.$leftitm[0].href = 'javascript:void(0)'; _self.$rightitm[0].href = 'javascript:void(0)'; // 澶勭悊宸﹀彸鍏冪礌鐨勭偣鍑讳簨浠? _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,dom) { var time=""; var l=-1; cleartimeout(time); if(this.support3d) { if(position=="outleft") { return { '-webkit-transform': 'translatex(-' + this.cssxout + 'px) translatez(-560px) rotatey(45deg)', '-moz-transform': 'translatex(-' + this.cssxout + 'px) translatez(-560px) rotatey(45deg)', '-o-transform': 'translatex(-' + this.cssxout + 'px) translatez(-560px) rotatey(45deg)', '-ms-transform': 'translatex(-' + this.cssxout + 'px) translatez(-560px) rotatey(45deg)', 'transform': 'translatex(-' + this.cssxout + 'px) translatez(-560px) rotatey(45deg)', 'opacity': 1 }; }else if(position=="outright"){ return { '-webkit-transform': 'translatex(' + this.cssxout + 'px) translatez(-560px) rotatey(-45deg)', '-moz-transform': 'translatex(' + this.cssxout + 'px) translatez(-560px) rotatey(-45deg)', '-o-transform': 'translatex(' + this.cssxout + 'px) translatez(-560px) rotatey(-45deg)', '-ms-transform': 'translatex(' + this.cssxout + 'px) translatez(-560px) rotatey(-45deg)', 'transform': 'translatex(' + this.cssxout + 'px) translatez(-560px) rotatey(-45deg)', 'opacity': 1 }; }else if(position=="left"){ return { '-webkit-transform': 'translatex(-' + this.cssx + 'px) translatez(-300px) rotatey(25deg)', '-moz-transform': 'translatex(-' + this.cssx + 'px) translatez(-300px) rotatey(25deg)', '-o-transform': 'translatex(-' + this.cssx + 'px) translatez(-300px) rotatey(25deg)', '-ms-transform': 'translatex(-' + this.cssx + 'px) translatez(-300px) rotatey(25deg)', 'transform': 'translatex(-' + this.cssx + 'px) translatez(-300px) rotatey(25deg)', 'opacity': 1, 'visibility': 'visible' }; }else if(position=="right"){ return { '-webkit-transform': 'translatex(' + this.cssx + 'px) translatez(-300px) rotatey(-25deg)', '-moz-transform': 'translatex(' + this.cssx + 'px) translatez(-300px) rotatey(-25deg)', '-o-transform': 'translatex(' + this.cssx + 'px) translatez(-300px) rotatey(-25deg)', '-ms-transform': 'translatex(' + this.cssx + 'px) translatez(-300px) rotatey(-25deg)', 'transform': 'translatex(' + this.cssx + 'px) translatez(-300px) rotatey(-25deg)', 'opacity': 1, 'visibility': 'visible' }; }else if(position=="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, 'visibility': 'visible' }; }else if(position=="hide"){ return { '-webkit-transform': 'translate(0px) scale(0.7)', 'opacity': 1, 'visibility': 'visible', 'z-index': 1 }; } } 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': 0, '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++; var time=""; cleartimeout(time); /*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',this.$currentitm)); // right item moves to the center this.$rightitm.addclass(speedclass).css(this._getcoordinates('center',this.$currentitm)); // left item moves out this.$leftitm.addclass(speedclass).css(this._getcoordinates('outleft',this.$currentitm)); this.$nextitm.addclass(speedclass).css(this._getcoordinates('right',this.$currentitm)); if(this.itemscount > 8) { this.$previtm.addclass(speedclass).css(this._getcoordinates('hide',this.$currentitm)); 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'); if(window.activexobject || "activexobject" in window) { for(var i = 0; i < $(".dg-wrapper").find("a").length - 1; i++) { $(".dg-wrapper").find("a").eq(this.current + i).css("z-index", this.current - i) if(this.current == $(".dg-wrapper").find("a").length - 1) { $(".dg-wrapper").find("a").eq($(".dg-wrapper").find("a").length - this.current - 1).css("z-index", this.current) } } } break; case 'prev': this.indexb--; if(this.indexb === -1) { this.indexb = this.itemscount - 1; } var time=""; cleartimeout(time); //this._showbutton(); this.current = this.$leftitm.index(); // current item moves right this.$currentitm.addclass(speedclass).css(this._getcoordinates('right',this.$currentitm)); // left item moves to the center this.$leftitm.addclass(speedclass).css(this._getcoordinates('center',this.$currentitm)); // right item moves out this.$rightitm.addclass(speedclass).css(this._getcoordinates('outright',this.$currentitm)); this.$previtm.addclass(speedclass).css(this._getcoordinates('left',this.$currentitm)); if(this.itemscount > 8) { this.$nextitm.addclass(speedclass).css(this._getcoordinates('hide',this.$currentitm)); 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'); if(window.activexobject || "activexobject" in window) { for(var i = 0; i < $(".dg-wrapper").find("a").length - 1; i++) { $(".dg-wrapper").find("a").eq(this.current - i).css("z-index", this.current - i) if(this.current == $(".dg-wrapper").find("a").length - 1) { console.log(this.current); $(".dg-wrapper").find("a").eq($(".dg-wrapper").find("a").length - this.current - 1).css("z-index", this.current); $(".dg-wrapper").find("a").eq($(".dg-wrapper").find("a").length - this.current - 2).css("z-index", this.current - 1); } } } 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);