/** * bxslider v4.1 - fully loaded, responsive content slider * http://bxslider.com * * copyright 2012, steven wanderski - http://stevenwanderski.com - http://bxcreative.com * written while drinking belgian ales and listening to jazz * * released under the wtfpl license - http://sam.zoy.org/wtfpl/ */ (function(e) { var t = {}, n = { 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", 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: !0, //自动切换,是:0,,否: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() {} }; e.fn.bxslider = function(s) { if (0 == this.length) return this; if (this.length > 1) return this.each(function() { e(this).bxslider(s) }), this; var o = {}, r = this; t.el = this; var a = e(window).width(), l = e(window).height(), d = function() { o.settings = e.extend({}, n, s), o.settings.slidewidth = parseint(o.settings.slidewidth), o.children = r.children(o.settings.slideselector), o.children.length < o.settings.minslides && (o.settings.minslides = o.children.length), o.children.length < o.settings.maxslides && (o.settings.maxslides = o.children.length), o.settings.randomstart && (o.settings.startslide = math.floor(math.random() * o.children.length)), o.active = { index: o.settings.startslide }, o.carousel = o.settings.minslides > 1 || 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 e = document.createelement("div"), t = ["webkitperspective", "mozperspective", "operspective", "msperspective"]; for (var i in t) if (void 0 !== e.style[t[i]]) return o.cssprefix = t[i].replace("perspective", "").tolowercase(), o.animprop = "-" + o.cssprefix + "-transform", !0; return ! 1 } (), "vertical" == o.settings.mode && (o.settings.maxslides = o.settings.minslides), c() }, c = function() { if (r.wrap('
'), o.viewport = r.parent(), o.loader = e('
'), o.viewport.prepend(o.loader), r.css({ width: "horizontal" == o.settings.mode ? 215 * o.children.length + "%": "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"), v(), o.viewport.css({ width: "100%", overflow: "hidden", position: "relative" }), o.viewport.parent().css({ maxwidth: u() }), o.children.css({ "float": "horizontal" == o.settings.mode ? "left": "none", liststyle: "none", position: "relative" }), o.children.width(p()), "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: 50, display: "block" })), o.controls.el = e('
'), o.settings.captions && e(), o.settings.infiniteloop && "fade" != o.settings.mode && !o.settings.ticker) { var t = "vertical" == o.settings.mode ? o.settings.minslides: o.settings.maxslides, i = o.children.slice(0, t).clone().addclass("bx-clone"), n = o.children.slice( - t).clone().addclass("bx-clone"); r.append(i).prepend(n) } o.active.last = o.settings.startslide == f() - 1, o.settings.video && r.fitvids(); var s = o.children.eq(o.settings.startslide); "all" == o.settings.preloadimages && (s = r.children()), o.settings.ticker ? o.settings.pager = !1 : (o.settings.pager && w(), o.settings.controls && t(), o.settings.auto && o.settings.autocontrols && c(), (o.settings.controls || o.settings.autocontrols || o.settings.pager) && o.viewport.after(o.controls.el)), s.imagesloaded(g) }, g = function() { o.loader.remove(), m(), "vertical" == o.settings.mode && (o.settings.adaptiveheight = !0), o.viewport.height(h()), r.redrawslider(), o.settings.onsliderload(o.active.index), o.initialized = !0, e(window).bind("resize", y), o.settings.auto && o.settings.autostart && l(), o.settings.ticker && w(), o.settings.pager && m(o.settings.startslide), o.settings.controls && d(), o.settings.touchenabled && !o.settings.ticker && o() }, h = function() { var t = 0, n = e(); if ("vertical" == o.settings.mode || o.settings.adaptiveheight) if (o.carousel) { var s = 1 == o.settings.moveslides ? o.active.index: o.active.index * x(); for (n = o.children.eq(s), i = 1; o.settings.maxslides - 1 >= i; i++) n = s + i >= o.children.length ? n.add(o.children.eq(i - 1)) : n.add(o.children.eq(s + i)) } else n = o.children.eq(o.active.index); else n = o.children; return "vertical" == o.settings.mode ? (n.each(function() { t += e(this).outerheight() }), o.settings.slidemargin > 0 && (t += o.settings.slidemargin * (o.settings.minslides - 1))) : t = math.max.apply(math, n.map(function() { return e(this).outerheight(!1) }).get()), t }, u = function() { var e = "100%"; return o.settings.slidewidth > 0 && (e = "horizontal" == o.settings.mode ? o.settings.maxslides * o.settings.slidewidth + (o.settings.maxslides - 1) * o.settings.slidemargin: o.settings.slidewidth), e }, p = function() { var e = o.settings.slidewidth, t = o.viewport.width(); return 0 == o.settings.slidewidth || o.settings.slidewidth > t && !o.carousel || "vertical" == o.settings.mode ? e = t: o.settings.maxslides > 1 && "horizontal" == o.settings.mode && (t > o.maxthreshold || o.minthreshold > t && (e = (t - o.settings.slidemargin * (o.settings.minslides - 1)) / o.settings.minslides)), e }, v = function() { var e = 1; if ("horizontal" == o.settings.mode && o.settings.slidewidth > 0) if (o.viewport.width() < o.minthreshold) e = o.settings.minslides; else if (o.viewport.width() > o.maxthreshold) e = o.settings.maxslides; else { var t = o.children.first().width(); e = math.floor(o.viewport.width() / t) } else "vertical" == o.settings.mode && (e = o.settings.minslides); return e }, f = function() { var e = 0; if (o.settings.moveslides > 0) if (o.settings.infiniteloop) e = o.children.length / x(); else for (var t = 0, i = 0; o.children.length > t;)++e, t = i + v(), i += o.settings.moveslides <= v() ? o.settings.moveslides: v(); else e = math.ceil(o.children.length / v()); return e }, x = function() { return o.settings.moveslides > 0 && o.settings.moveslides <= v() ? o.settings.moveslides: v() }, m = function() { if (o.children.length > o.settings.maxslides && o.active.last && !o.settings.infiniteloop) { if ("horizontal" == o.settings.mode) { var e = o.children.last(), t = e.position(); s( - (t.left - (o.viewport.width() - e.width())), "reset", 0) } else if ("vertical" == o.settings.mode) { var i = o.children.length - o.settings.minslides, t = o.children.eq(i).position(); s( - t.top, "reset", 0) } } else { var t = o.children.eq(o.active.index * x()).position(); o.active.index == f() - 1 && (o.active.last = !0), void 0 != t && ("horizontal" == o.settings.mode ? s( - t.left, "reset", 0) : "vertical" == o.settings.mode && s( - t.top, "reset", 0)) } }, s = function(e, t, i, n) { if (o.usingcss) { var s = "vertical" == o.settings.mode ? "translate3d(0, " + e + "px, 0)": "translate3d(" + e + "px, 0, 0)"; r.css("-" + o.cssprefix + "-transition-duration", i / 1e3 + "s"), "slide" == t ? (r.css(o.animprop, s), r.bind("transitionend webkittransitionend otransitionend mstransitionend", function() { r.unbind("transitionend webkittransitionend otransitionend mstransitionend"), i() })) : "reset" == t ? r.css(o.animprop, s) : "ticker" == t && (r.css("-" + o.cssprefix + "-transition-timing-function", "linear"), r.css(o.animprop, s), r.bind("transitionend webkittransitionend otransitionend mstransitionend", function() { r.unbind("transitionend webkittransitionend otransitionend mstransitionend"), s(n.resetvalue, "reset", 0), h() })) } else { var a = {}; a[o.animprop] = e, "slide" == t ? r.animate(a, i, o.settings.easing, function() { i() }) : "reset" == t ? r.css(o.animprop, e) : "ticker" == t && r.animate(a, speed, "linear", function() { s(n.resetvalue, "reset", 0), h() }) } }, b = function() { for (var t = "", i = f(), n = 0; i > n; n++) { var s = ""; o.settings.buildpager && e.isfunction(o.settings.buildpager) ? (s = o.settings.buildpager(n), o.pagerel.addclass("bx-custom-pager")) : (s = n + 1, o.pagerel.addclass("bx-default-pager")), t += '" } o.pagerel.html(t) }, w = function() { o.settings.pagercustom ? o.pagerel = e(o.settings.pagercustom) : (o.pagerel = e('
'), o.settings.pagerselector ? e(o.settings.pagerselector).html(o.pagerel) : o.controls.el.addclass("bx-has-pager").append(o.pagerel), b()), o.pagerel.delegate("a", "click", z) }, t = function() { o.controls.next = e('' + o.settings.nexttext + ""), o.controls.prev = e('' + o.settings.prevtext + ""), o.controls.next.bind("click", a), o.controls.prev.bind("click", p), o.settings.nextselector && e(o.settings.nextselector).append(o.controls.next), o.settings.prevselector && e(o.settings.prevselector).append(o.controls.prev), o.settings.nextselector || o.settings.prevselector || (o.controls.directionel = e('
'), o.controls.directionel.append(o.controls.prev).append(o.controls.next), o.controls.el.addclass("bx-has-controls-direction").append(o.controls.directionel)) }, c = function() { o.controls.start = e('"), o.controls.stop = e('"), o.controls.autoel = e('
'), o.controls.autoel.delegate(".bx-start", "click", k), o.controls.autoel.delegate(".bx-stop", "click", y), o.settings.autocontrolscombine ? o.controls.autoel.append(o.controls.start) : o.controls.autoel.append(o.controls.start).append(o.controls.stop), o.settings.autocontrolsselector ? e(o.settings.autocontrolsselector).html(o.controls.autoel) : o.controls.el.addclass("bx-has-controls-auto").append(o.controls.autoel), q(o.settings.autostart ? "stop": "start") }, e = function() { o.children.each(function() { var t = e(this).find("img:first").attr("title"); void 0 != t && e(this).append('
' + t + "
") }) }, a = function(e) { o.settings.auto && r.stopauto(), r.gotonextslide(), e.preventdefault() }, p = function(e) { o.settings.auto && r.stopauto(), r.gotoprevslide(), e.preventdefault() }, k = function(e) { r.startauto(), e.preventdefault() }, y = function(e) { r.stopauto(), e.preventdefault() }, z = function(t) { o.settings.auto && r.stopauto(); var i = e(t.currenttarget), n = parseint(i.attr("data-slide-index")); n != o.active.index && r.gotoslide(n), t.preventdefault() }, m = function(t) { return "short" == o.settings.pagertype ? (o.pagerel.html(t + 1 + o.settings.pagershortseparator + o.children.length), void 0) : (o.pagerel.find("a").removeclass("active"), o.pagerel.each(function(i, n) { e(n).find("a").eq(t).addclass("active") }), void 0) }, i = function() { if (o.settings.infiniteloop) { var e = ""; 0 == o.active.index ? e = o.children.eq(0).position() : o.active.index == f() - 1 && o.carousel ? e = o.children.eq((f() - 1) * x()).position() : o.active.index == o.children.length - 1 && (e = o.children.eq(o.children.length - 1).position()), "horizontal" == o.settings.mode ? s( - e.left, "reset", 0) : "vertical" == o.settings.mode && s( - e.top, "reset", 0) } o.working = !1, o.settings.onslideafter(o.children.eq(o.active.index), o.oldindex, o.active.index) }, q = function(e) { o.settings.autocontrolscombine ? o.controls.autoel.html(o.controls[e]) : (o.controls.autoel.find("a").removeclass("active"), o.controls.autoel.find("a:not(.bx-" + e + ")").addclass("active")) }, d = function() { 1 == f() ? (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 == f() - 1 ? (o.controls.next.addclass("disabled"), o.controls.prev.removeclass("disabled")) : (o.controls.prev.removeclass("disabled"), o.controls.next.removeclass("disabled"))) }, l = 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) }) }, w = function() { var t = 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(); t = "horizontal" == o.settings.mode ? -i.left: -i.top } s(t, "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 t = 0; o.children.each(function() { t += "horizontal" == o.settings.mode ? e(this).outerwidth(!0) : e(this).outerheight(!0) }); var i = o.settings.speed / t, n = "horizontal" == o.settings.mode ? "left": "top", s = i * (t - math.abs(parseint(r.css(n)))); h(s) }), h() }, h = function(e) { speed = e ? e: o.settings.speed; var t = { left: 0, top: 0 }, i = { left: 0, top: 0 }; "next" == o.settings.autodirection ? t = r.find(".bx-clone").first().position() : i = o.children.first().position(); var n = "horizontal" == o.settings.mode ? -t.left: -t.top, s = "horizontal" == o.settings.mode ? -i.left: -i.top, a = { resetvalue: s }; s(n, "ticker", speed, a) }, o = function() { o.touch = { start: { x: 0, y: 0 }, end: { x: 0, y: 0 } }, o.viewport.bind("touchstart", n) }, n = function(e) { if (o.working) e.preventdefault(); else { o.touch.originalpos = r.position(); var t = e.originalevent; o.touch.start.x = t.changedtouches[0].pagex, o.touch.start.y = t.changedtouches[0].pagey, o.viewport.bind("touchmove", b), o.viewport.bind("touchend", x) } }, b = function(e) { var t = e.originalevent, i = math.abs(t.changedtouches[0].pagex - o.touch.start.x), n = math.abs(t.changedtouches[0].pagey - o.touch.start.y); if (3 * i > n && o.settings.preventdefaultswipex ? e.preventdefault() : 3 * n > i && o.settings.preventdefaultswipey && e.preventdefault(), "fade" != o.settings.mode && o.settings.onetoonetouch) { var s = 0; if ("horizontal" == o.settings.mode) { var r = t.changedtouches[0].pagex - o.touch.start.x; s = o.touch.originalpos.left + r } else { var r = t.changedtouches[0].pagey - o.touch.start.y; s = o.touch.originalpos.top + r } s(s, "reset", 0) } }, x = function(e) { o.viewport.unbind("touchmove", b); var t = e.originalevent, i = 0; if (o.touch.end.x = t.changedtouches[0].pagex, o.touch.end.y = t.changedtouches[0].pagey, "fade" == o.settings.mode) { var n = math.abs(o.touch.start.x - o.touch.end.x); n >= o.settings.swipethreshold && (o.touch.start.x > o.touch.end.x ? r.gotonextslide() : r.gotoprevslide(), r.stopauto()) } else { var n = 0; "horizontal" == o.settings.mode ? (n = o.touch.end.x - o.touch.start.x, i = o.touch.originalpos.left) : (n = o.touch.end.y - o.touch.start.y, i = o.touch.originalpos.top), !o.settings.infiniteloop && (0 == o.active.index && n > 0 || o.active.last && 0 > n) ? s(i, "reset", 200) : math.abs(n) >= o.settings.swipethreshold ? (0 > n ? r.gotonextslide() : r.gotoprevslide(), r.stopauto()) : s(i, "reset", 200) } o.viewport.unbind("touchend", x) }, y = function() { var t = e(window).width(), i = e(window).height(); (a != t || l != i) && (a = t, l = i, r.redrawslider()) }; return r.gotoslide = function(t, i) { if (!o.working && o.active.index != t) if (o.working = !0, o.oldindex = o.active.index, o.active.index = 0 > t ? f() - 1 : t >= f() ? 0 : t, 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 >= f() - 1, o.settings.pager && m(o.active.index), o.settings.controls && d(), "fade" == o.settings.mode) o.settings.adaptiveheight && o.viewport.height() != h() && o.viewport.animate({ height: h() }, o.settings.adaptiveheightspeed), o.children.filter(":visible").fadeout(o.settings.speed).css({ zindex: 0 }), o.children.eq(o.active.index).css("zindex", 51).fadein(o.settings.speed, function() { e(this).css("zindex", 50), i() }); else { o.settings.adaptiveheight && o.viewport.height() != h() && o.viewport.animate({ height: h() }, o.settings.adaptiveheightspeed); var n = 0, s = { 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); s = a.position(), n = o.viewport.width() - a.width() } else { var l = o.children.length - o.settings.minslides; s = o.children.eq(l).position() } else if (o.carousel && o.active.last && "prev" == i) { var d = 1 == o.settings.moveslides ? o.settings.maxslides - x() : (f() - 1) * x() - (o.children.length - o.settings.maxslides), a = r.children(".bx-clone").eq(d); s = a.position() } else if ("next" == i && 0 == o.active.index) s = r.find("> .bx-clone").eq(o.settings.maxslides).position(), o.active.last = !1; else if (t >= 0) { var c = t * x(); s = o.children.eq(c).position() } if (s !== void 0) { var g = "horizontal" == o.settings.mode ? -(s.left - n) : -s.top; s(g, "slide", o.settings.speed) } } }, r.gotonextslide = function() { if (o.settings.infiniteloop || !o.active.last) { var e = parseint(o.active.index) + 1; r.gotoslide(e, "next") } }, r.gotoprevslide = function() { if (o.settings.infiniteloop || 0 != o.active.index) { var e = parseint(o.active.index) - 1; r.gotoslide(e, "prev") } }, r.startauto = function(e) { o.interval || (o.interval = setinterval(function() { "next" == o.settings.autodirection ? r.gotonextslide() : r.gotoprevslide() }, o.settings.pause), o.settings.autocontrols && 1 != e && q("stop")) }, r.stopauto = function(e) { o.interval && (clearinterval(o.interval), o.interval = null, o.settings.autocontrols && 1 != e && q("start")) }, r.getcurrentslide = function() { return o.active.index }, r.getslidecount = function() { return o.children.length }, r.redrawslider = function() { o.children.add(r.find(".bx-clone")).width(p()), o.viewport.css("height", h()), o.settings.ticker || m(), o.active.last && (o.active.index = f() - 1), o.active.index >= f() && (o.active.last = !0), o.settings.pager && !o.settings.pagercustom && (b(), m(o.active.index)) }, r.destroyslider = function() { o.initialized && (o.initialized = !1, e(".bx-clone", this).remove(), o.children.removeattr("style"), this.removeattr("style").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.pagerel.remove(), e(".bx-caption", this).remove(), o.controls.autoel && o.controls.autoel.remove(), clearinterval(o.interval), e(window).unbind("resize", y)) }, r.reloadslider = function(e) { void 0 != e && (s = e), r.destroyslider(), d() }, d(), this } })(jquery), function(e, t) { var i = "data:image/gif;base64,r0lgodlhaqabaiaaaaaaap///ywaaaaaaqabaaacauwaow=="; e.fn.imagesloaded = function(n) { function s() { var t = e(g), i = e(h); a && (h.length ? a.reject(d, t, i) : a.resolve(d)), e.isfunction(n) && n.call(r, d, t, i) } function o(t, n) { t.src === i || -1 !== e.inarray(t, c) || (c.push(t), n ? h.push(t) : g.push(t), e.data(t, "imagesloaded", { isbroken: n, src: t.src }), l && a.notifywith(e(t), [n, d, e(g), e(h)]), d.length === c.length && (settimeout(s), d.unbind(".imagesloaded"))) } var r = this, a = e.isfunction(e.deferred) ? e.deferred() : 0, l = e.isfunction(a.notify), d = r.find("img").add(r.filter("img")), c = [], g = [], h = []; return e.isplainobject(n) && e.each(n, function(e, t) { "callback" === e ? n = t: a && a[e](t) }), d.length ? d.bind("load.imagesloaded error.imagesloaded", function(e) { o(e.target, "error" === e.type) }).each(function(n, s) { var r = s.src, a = e.data(s, "imagesloaded"); a && a.src === r ? o(s, a.isbroken) : s.complete && s.naturalwidth !== t ? o(s, 0 === s.naturalwidth || 0 === s.naturalheight) : (s.readystate || s.complete) && (s.src = i, s.src = r) }) : s(), a ? a.promise(r) : r } } (jquery);