/*! * superslide v2.1 * 轻松解决网站大部分特效展示问题 * * copyright 2011-2013, 大话主席 * 请尊重原创,保留头部版权 * 在保留版权的前提下可应用于个人或商业用途 */ (function(a) { a.fn.slide = function(b) { return a.fn.slide.defaults = { type: "slide", effect: "fade", autoplay: !1, delaytime: 1000, intertime: 4000, triggertime: 150, defaultindex: 0, titcell: ".hd li", maincell: ".bd", targetcell: null, trigger: "mouseover", scroll: 1, vis: 1, titonclassname: "on", autopage:true, prevcell: ".prev", nextcell: ".next", pagestatecell: ".pagestate", opp: !1, pnloop: !0, easing: "swing", startfun: null, endfun: null, switchload: null, playstatecell: ".playstate", mouseoverstop: !0, defaultplay: !0, returndefault: !1 }, this.each(function() { var c = a.extend({}, a.fn.slide.defaults, b), d = a(this), e = c.effect, f = a(c.prevcell, d), g = a(c.nextcell, d), h = a(c.pagestatecell, d), i = a(c.playstatecell, d), j = a(c.titcell, d), k = j.size(), l = a(c.maincell, d), m = l.children().size(), n = c.switchload, o = a(c.targetcell, d), p = parseint(c.defaultindex), q = parseint(c.delaytime), r = parseint(c.intertime); parseint(c.triggertime); var p, t = parseint(c.scroll), u = parseint(c.vis), v = "false" == c.autoplay || 0 == c.autoplay ? !1 : !0, w = "false" == c.opp || 0 == c.opp ? !1 : !0, x = "false" == c.autopage || 0 == c.autopage ? !1 : !0, y = "false" == c.pnloop || 0 == c.pnloop ? !1 : !0, z = "false" == c.mouseoverstop || 0 == c.mouseoverstop ? !1 : !0, a = "false" == c.defaultplay || 0 == c.defaultplay ? !1 : !0, b = "false" == c.returndefault || 0 == c.returndefault ? !1 : !0, c = 0, d = 0, e = 0, f = 0, g = c.easing, h = null, i = null, j = null, k = c.titonclassname, l = j.index(d.find("." + k)), m = p = defaultindex = -1 == l ? p: l, n = p, o = m >= u ? 0 != m % t ? m % t: t: 0, q = "leftmarquee" == e || "topmarquee" == e ? !0 : !1, r = function() { a.isfunction(c.startfun) && c.startfun(p, k, d, a(c.titcell, d), l, o, f, g) }, s = function() { a.isfunction(c.endfun) && c.endfun(p, k, d, a(c.titcell, d), l, o, f, g) }, t = function() { j.removeclass(k), a && j.eq(defaultindex).addclass(k) }; //debugger; if ("menu" == c.type) return a && j.removeclass(k).eq(p).addclass(k), j.hover(function() { p = a(this).find(c.targetcell); var b = j.index(a(this)); i = settimeout(function() { switch (p = b, j.removeclass(k).eq(p).addclass(k), r(), e) { case "fade": p.stop(!0, !0).animate({ opacity: "show" }, q, g, s); break; case "slidedown": p.stop(!0, !0).animate({ height: "show" }, q, g, s) } }, c.triggertime) }, function() { switch (cleartimeout(i), e) { case "fade": p.animate({ opacity: "hide" }, q, g); break; case "slidedown": p.animate({ height: "hide" }, q, g) } }), b && d.hover(function() { cleartimeout(j) }, function() { j = settimeout(t, q) }), void 0; if (0 == k && (k = m), q && (k = 2), x) { if (m >= u) if ("leftloop" == e || "toploop" == e) k = 0 != m % t ? (0 ^ m / t) + 1 : m / t; else { var u = m - u; k = 1 + parseint(0 != u % t ? u / t + 1 : u / t), 0 >= k && (k = 1) } else k = 1; j.html(""); var v = ""; if (1 == c.autopage || "true" == c.autopage) for (var w = 0; k > w; w++) v += "
  • " + (w + 1) + "
  • "; else for (var w = 0; k > w; w++) v += c.autopage.replace("$", w + 1); j.html(v); var j = j.children() } if (m >= u) { l.children().each(function() { a(this).width() > e && (e = a(this).width(), d = a(this).outerwidth(!0)), a(this).height() > f && (f = a(this).height(), c = a(this).outerheight(!0)) }); var x = l.children(), y = function() { for (var a = 0; u > a; a++) x.eq(a).clone().addclass("clone").appendto(l); for (var a = 0; o > a; a++) x.eq(m - a - 1).clone().addclass("clone").prependto(l) }; switch (e) { case "fold": l.css({ position: "relative", width:"100%", height: c }).children().css({ // position: "absolute", // width:"100%", // top: 0, display: "none" // visibility: 'hidden' }); break; case "top": l.wrap('
    ').css({ top: -(p * t) * c, position: "relative", padding: "0", margin: "0" }).children().css({ height: f }); break; case "left": l.wrap('
    ').css({ width: m * d, left: -(p * t) * d, position: "relative", overflow: "hidden", padding: "0", margin: "0" }).children().css({ "float": "left", width: e }); break; case "leftloop": case "leftmarquee": y(), l.wrap('
    ').css({ width: (m + u + o) * d, position: "relative", overflow: "hidden", padding: "0", margin: "0", left: -(o + p * t) * d }).children().css({ "float": "left", width: e }); break; case "toploop": case "topmarquee": y(), l.wrap('
    ').css({ height: (m + u + o) * c, position: "relative", padding: "0", margin: "0", top: -(o + p * t) * c }).children().css({ height: f }) } } var z = function(a) { var b = a * t; return a == k ? b = m: -1 == a && 0 != m % t && (b = -m % t), b }, $ = function(b) { var c = function(c) { for (var d = c; u + c > d; d++) b.eq(d).find("img[" + n + "]").each(function() { var b = a(this); if (b.attr("src", b.attr(n)).removeattr(n), l.find(".clone")[0]) for (var c = l.children(), d = 0; c.size() > d; d++) c.eq(d).find("img[" + n + "]").each(function() { a(this).attr(n) == b.attr("src") && a(this).attr("src", a(this).attr(n)).removeattr(n) }) }) }; switch (e) { case "fade": case "fold": case "top": case "left": case "slidedown": c(p * t); break; case "leftloop": case "toploop": c(o + z(n)); break; case "leftmarquee": case "topmarquee": var d = "leftmarquee" == e ? l.css("left").replace("px", "") : l.css("top").replace("px", ""), f = "leftmarquee" == e ? d: c, g = o; if (0 != d % f) { var h = math.abs(0 ^ d / f); g = 1 == p ? o + h: o + h - 1 } c(g) } }, _ = function(a) { if (!a || m != p || a || q) { if (q ? p >= 1 ? p = 1 : 0 >= p && (p = 0) : (n = p, p >= k ? p = 0 : 0 > p && (p = k - 1)), r(), null != n && $(l.children()), o[0] && (p = o.eq(p), null != n && $(o), "slidedown" == e ? (o.not(p).stop(!0, !0).slideup(q), p.slidedown(q, g, function() { l[0] || s() })) : (o.not(p).stop(!0, !0).hide(), p.animate({ opacity: "show" }, q, function() { l[0] || s() }))), m >= u) switch (e) { case "fade": l.children().stop(!0, !0).eq(p).animate({ opacity: "show" }, q, g, function() { s() }).siblings().hide(); break; case "fold": l.children().stop(!0, !0).eq(p).animate({ opacity: "show" }, q, g, function() { s() }).siblings().animate({ //opacity: "hide" }, q, g); break; case "top": l.stop(!0, !1).animate({ top: -p * t * c }, q, g, function() { s() }); break; case "left": l.stop(!0, !1).animate({ left: -p * t * d }, q, g, function() { s() }); break; case "leftloop": var b = n; l.stop(!0, !0).animate({ left: -(z(n) + o) * d }, q, g, function() { - 1 >= b ? l.css("left", -(o + (k - 1) * t) * d) : b >= k && l.css("left", -o * d), s() }); break; case "toploop": var b = n; l.stop(!0, !0).animate({ top: -(z(n) + o) * c }, q, g, function() { - 1 >= b ? l.css("top", -(o + (k - 1) * t) * c) : b >= k && l.css("top", -o * c), s() }); break; case "leftmarquee": var c = l.css("left").replace("px", ""); 0 == p ? l.animate({ left: ++c }, 0, function() { l.css("left").replace("px", "") >= 0 && l.css("left", -m * d) }) : l.animate({ left: --c }, 0, function() { - (m + o) * d >= l.css("left").replace("px", "") && l.css("left", -o * d) }); break; case "topmarquee": var d = l.css("top").replace("px", ""); 0 == p ? l.animate({ top: ++d }, 0, function() { l.css("top").replace("px", "") >= 0 && l.css("top", -m * c) }) : l.animate({ top: --d }, 0, function() { - (m + o) * c >= l.css("top").replace("px", "") && l.css("top", -o * c) }) } j.removeclass(k).eq(p).addclass(k), m = p, y || (g.removeclass("nextstop"), f.removeclass("prevstop"), 0 == p && f.addclass("prevstop"), p == k - 1 && g.addclass("nextstop")), h.html("" + (p + 1) + "/" + k) } }; a && _(!0), b && d.hover(function() { cleartimeout(j) }, function() { j = settimeout(function() { p = defaultindex, a ? _() : "slidedown" == e ? p.slideup(q, t) : p.animate({ opacity: "hide" }, q, t), m = p }, 300) }); var ab = function(a) { h = setinterval(function() { w ? p--:p++, _() }, a ? a: r) }, bb = function(a) { h = setinterval(_, a ? a: r) }, cb = function() { z || (clearinterval(h), ab()) }, db = function() { (y || p != k - 1) && (p++, _(), q || cb()) }, eb = function() { (y || 0 != p) && (p--, _(), q || cb()) }, fb = function() { clearinterval(h), q ? bb() : ab(), i.removeclass("pausestate") }, gb = function() { clearinterval(h), i.addclass("pausestate") }; if (v ? q ? (w ? p--:p++, bb(), z && l.hover(gb, fb)) : (ab(), z && d.hover(gb, fb)) : (q && (w ? p--:p++), i.addclass("pausestate")), i.click(function() { i.hasclass("pausestate") ? fb() : gb() }), "mouseover" == c.trigger ? j.hover(function() { var a = j.index(this); i = settimeout(function() { p = a, _(), cb() }, c.triggertime) }, function() { cleartimeout(i) }) : j.click(function() { p = j.index(this), _(), cb() }), q) { if (g.mousedown(db), f.mousedown(eb), y) { var hb, ib = function() { hb = settimeout(function() { clearinterval(h), bb(0 ^ r / 10) }, 150) }, jb = function() { cleartimeout(hb), clearinterval(h), bb() }; g.mousedown(ib), g.mouseup(jb), f.mousedown(ib), f.mouseup(jb) } "mouseover" == c.trigger && (g.hover(db, function() {}), f.hover(eb, function() {})) } else g.click(db), f.click(eb) }) } })(jquery), jquery.easing.jswing = jquery.easing.swing, jquery.extend(jquery.easing, { def: "easeoutquad", swing: function(a, b, c, d, e) { return jquery.easing[jquery.easing.def](a, b, c, d, e) }, easeinquad: function(a, b, c, d, e) { return d * (b /= e) * b + c }, easeoutquad: function(a, b, c, d, e) { return - d * (b /= e) * (b - 2) + c }, easeinoutquad: function(a, b, c, d, e) { return 1 > (b /= e / 2) ? d / 2 * b * b + c: -d / 2 * (--b * (b - 2) - 1) + c }, easeincubic: function(a, b, c, d, e) { return d * (b /= e) * b * b + c }, easeoutcubic: function(a, b, c, d, e) { return d * ((b = b / e - 1) * b * b + 1) + c }, easeinoutcubic: function(a, b, c, d, e) { return 1 > (b /= e / 2) ? d / 2 * b * b * b + c: d / 2 * ((b -= 2) * b * b + 2) + c }, easeinquart: function(a, b, c, d, e) { return d * (b /= e) * b * b * b + c }, easeoutquart: function(a, b, c, d, e) { return - d * ((b = b / e - 1) * b * b * b - 1) + c }, easeinoutquart: function(a, b, c, d, e) { return 1 > (b /= e / 2) ? d / 2 * b * b * b * b + c: -d / 2 * ((b -= 2) * b * b * b - 2) + c }, easeinquint: function(a, b, c, d, e) { return d * (b /= e) * b * b * b * b + c }, easeoutquint: function(a, b, c, d, e) { return d * ((b = b / e - 1) * b * b * b * b + 1) + c }, easeinoutquint: function(a, b, c, d, e) { return 1 > (b /= e / 2) ? d / 2 * b * b * b * b * b + c: d / 2 * ((b -= 2) * b * b * b * b + 2) + c }, easeinsine: function(a, b, c, d, e) { return - d * math.cos(b / e * (math.pi / 2)) + d + c }, easeoutsine: function(a, b, c, d, e) { return d * math.sin(b / e * (math.pi / 2)) + c }, easeinoutsine: function(a, b, c, d, e) { return - d / 2 * (math.cos(math.pi * b / e) - 1) + c }, easeinexpo: function(a, b, c, d, e) { return 0 == b ? c: d * math.pow(2, 10 * (b / e - 1)) + c }, easeoutexpo: function(a, b, c, d, e) { return b == e ? c + d: d * ( - math.pow(2, -10 * b / e) + 1) + c }, easeinoutexpo: function(a, b, c, d, e) { return 0 == b ? c: b == e ? c + d: 1 > (b /= e / 2) ? d / 2 * math.pow(2, 10 * (b - 1)) + c: d / 2 * ( - math.pow(2, -10 * --b) + 2) + c }, easeincirc: function(a, b, c, d, e) { return - d * (math.sqrt(1 - (b /= e) * b) - 1) + c }, easeoutcirc: function(a, b, c, d, e) { return d * math.sqrt(1 - (b = b / e - 1) * b) + c }, easeinoutcirc: function(a, b, c, d, e) { return 1 > (b /= e / 2) ? -d / 2 * (math.sqrt(1 - b * b) - 1) + c: d / 2 * (math.sqrt(1 - (b -= 2) * b) + 1) + c }, easeinelastic: function(a, b, c, d, e) { var f = 1.70158, g = 0, h = d; if (0 == b) return c; if (1 == (b /= e)) return c + d; if (g || (g = .3 * e), math.abs(d) > h) { h = d; var f = g / 4 } else var f = g / (2 * math.pi) * math.asin(d / h); return - (h * math.pow(2, 10 * (b -= 1)) * math.sin((b * e - f) * 2 * math.pi / g)) + c }, easeoutelastic: function(a, b, c, d, e) { var f = 1.70158, g = 0, h = d; if (0 == b) return c; if (1 == (b /= e)) return c + d; if (g || (g = .3 * e), math.abs(d) > h) { h = d; var f = g / 4 } else var f = g / (2 * math.pi) * math.asin(d / h); return h * math.pow(2, -10 * b) * math.sin((b * e - f) * 2 * math.pi / g) + d + c }, easeinoutelastic: function(a, b, c, d, e) { var f = 1.70158, g = 0, h = d; if (0 == b) return c; if (2 == (b /= e / 2)) return c + d; if (g || (g = e * .3 * 1.5), math.abs(d) > h) { h = d; var f = g / 4 } else var f = g / (2 * math.pi) * math.asin(d / h); return 1 > b ? -.5 * h * math.pow(2, 10 * (b -= 1)) * math.sin((b * e - f) * 2 * math.pi / g) + c: .5 * h * math.pow(2, -10 * (b -= 1)) * math.sin((b * e - f) * 2 * math.pi / g) + d + c }, easeinback: function(a, b, c, d, e, f) { return void 0 == f && (f = 1.70158), d * (b /= e) * b * ((f + 1) * b - f) + c }, easeoutback: function(a, b, c, d, e, f) { return void 0 == f && (f = 1.70158), d * ((b = b / e - 1) * b * ((f + 1) * b + f) + 1) + c }, easeinoutback: function(a, b, c, d, e, f) { return void 0 == f && (f = 1.70158), 1 > (b /= e / 2) ? d / 2 * b * b * (((f *= 1.525) + 1) * b - f) + c: d / 2 * ((b -= 2) * b * (((f *= 1.525) + 1) * b + f) + 2) + c }, easeinbounce: function(a, b, c, d, e) { return d - jquery.easing.easeoutbounce(a, e - b, 0, d, e) + c }, easeoutbounce: function(a, b, c, d, e) { return 1 / 2.75 > (b /= e) ? d * 7.5625 * b * b + c: 2 / 2.75 > b ? d * (7.5625 * (b -= 1.5 / 2.75) * b + .75) + c: 2.5 / 2.75 > b ? d * (7.5625 * (b -= 2.25 / 2.75) * b + .9375) + c: d * (7.5625 * (b -= 2.625 / 2.75) * b + .984375) + c }, easeinoutbounce: function(a, b, c, d, e) { return e / 2 > b ? .5 * jquery.easing.easeinbounce(a, 2 * b, 0, d, e) + c: .5 * jquery.easing.easeoutbounce(a, 2 * b - e, 0, d, e) + .5 * d + c } });