/*!
* superslide v2.1.2
* 轻松解决网站大部分特效展示问题
* 详尽信息请看官网:http://www.superslide2.com/
*
* copyright 2011-2015, 大话主席
*
* 请尊重原创,保留头部版权
* 在保留版权的前提下可应用于个人或商业用途
* v2.1.1:修复当调用多个superslide,并设置returndefault:true 时返回defaultindex索引错误
* v2.1.2:增加参数设置vis:"auto",解决左滚动自适应窗口宽度问题。适应情况:vis:"auto",scroll:1, effect:"left或leftloop"(注:此为临时解决方案,日后版本可能变动)
* v2.1.2:修复 mouseoverstop 和 autoplay均为false下,点击切换按钮后会自动播放bug
*/
(function(a) {
a.fn.slide = function(b) {
a.fn.slide.defaults = {
type: "slide",
effect: "fade",
autoplay: false,
delaytime: 500,
intertime: 2500,
triggertime: 150,
defaultindex: 0,
titcell: ".hd li",
maincell: ".bd",
targetcell: null,
trigger: "mouseover",
scroll: 1,
vis: 1,
titonclassname: "on",
autopage: false,
prevcell: ".prev",
nextcell: ".next",
pagestatecell: ".pagestate",
opp: false,
pnloop: true,
easing: "swing",
startfun: null,
endfun: null,
switchload: null,
playstatecell: ".playstate",
mouseoverstop: true,
defaultplay: true,
returndefault: false
};
return this.each(function() {
var i = a.extend({}, a.fn.slide.defaults, b);
var g = a(this);
var af = i.effect;
var o = a(i.prevcell, g);
var h = a(i.nextcell, g);
var g = a(i.pagestatecell, g);
var n = a(i.playstatecell, g);
var b = a(i.titcell, g);
var m = b.size();
var aa = a(i.maincell, g);
var e = aa.children().size();
var h = i.switchload;
var ai = a(i.targetcell, g);
var k = parseint(i.defaultindex);
var z = parseint(i.delaytime);
var p = parseint(i.intertime);
var aq = parseint(i.triggertime);
var ac = parseint(i.scroll);
var ab = (i.autoplay == "false" || i.autoplay == false) ? false : true;
var c = (i.opp == "false" || i.opp == false) ? false : true;
var s = (i.autopage == "false" || i.autopage == false) ? false : true;
var p = (i.pnloop == "false" || i.pnloop == false) ? false : true;
var ae = (i.mouseoverstop == "false" || i.mouseoverstop == false) ? false : true;
var x = (i.defaultplay == "false" || i.defaultplay == false) ? false : true;
var q = (i.returndefault == "false" || i.returndefault == false) ? false : true;
var ag = isnan(i.vis) ? 1 : parseint(i.vis);
var an = !-[1, ] && !window.xmlhttprequest;
var j = 0;
var f = 0;
var q = 0;
var e = 0;
var r = i.easing;
var ad = null;
var m = null;
var w = null;
var ap = i.titonclassname;
var d = b.index(g.find("." + ap));
var ao = k = d == -1 ? k : d;
var f = k;
var am = k;
var r = e >= ag ? (e % ac != 0 ? e % ac : ac) : 0;
var v;
var u = af == "leftmarquee" || af == "topmarquee" ? true : false;
var al = function() {
if (a.isfunction(i.startfun)) {
i.startfun(k, m, g, a(i.titcell, g), aa, ai, o, h)
}
};
var j = function() {
if (a.isfunction(i.endfun)) {
i.endfun(k, m, g, a(i.titcell, g), aa, ai, o, h)
}
};
var c = function() {
b.removeclass(ap);
if (x) {
b.eq(f).addclass(ap)
}
};
if (i.type == "menu") {
if (x) {
b.removeclass(ap).eq(k).addclass(ap)
}
b.hover(function() {
v = a(this).find(i.targetcell);
var i = b.index(a(this));
m = settimeout(function() {
k = i;
b.removeclass(ap).eq(k).addclass(ap);
al();
switch (af) {
case "fade":
v.stop(true, true).animate({
opacity: "show"
}, z, r, j);
break;
case "slidedown":
v.stop(true, true).animate({
height: "show"
}, z, r, j);
break
}
}, i.triggertime)
}, function() {
cleartimeout(m);
switch (af) {
case "fade":
v.animate({
opacity: "hide"
}, z, r);
break;
case "slidedown":
v.animate({
height: "hide"
}, z, r);
break
}
});
if (q) {
g.hover(function() {
cleartimeout(w)
}, function() {
w = settimeout(c, z)
})
}
return
}
if (m == 0) {
m = e
}
if (u) {
m = 2
}
if (s) {
if (e >= ag) {
if (af == "leftloop" || af == "toploop") {
m = e % ac != 0 ? (e / ac ^ 0) + 1 : e / ac
} else {
var s = e - ag;
m = 1 + parseint(s % ac != 0 ? (s / ac + 1) : (s / ac));
if (m <= 0) {
m = 1
}
}
} else {
m = 1
}
b.html("");
var l = "";
if (i.autopage == true || i.autopage == "true") {
for (var ak = 0; ak < m; ak++) {
l += "
" + (ak + 1) + ""
}
} else {
for (var ak = 0; ak < m; ak++) {
l += i.autopage.replace("$", (ak + 1))
}
}
b.html(l);
var b = b.children()
}
if (e >= ag) {
aa.children().each(function() {
if (a(this).width() > q) {
q = a(this).width();
f = a(this).outerwidth(true)
}
if (a(this).height() > e) {
e = a(this).height();
j = a(this).outerheight(true)
}
});
var y = aa.children();
var w = function() {
for (var ar = 0; ar < ag; ar++) {
y.eq(ar).clone().addclass("clone").appendto(aa)
}
for (var ar = 0; ar < r; ar++) {
y.eq(e - ar - 1).clone().addclass("clone").prependto(aa)
}
};
switch (af) {
case "fold":
aa.css({
"position": "relative",
"width": f,
"height": j
}).children().css({
"position": "absolute",
"width": q,
"left": 0,
"top": 0,
"display": "none"
});
break;
case "top":
aa.wrap('').css({
"top": -(k * ac) * j,
"position": "relative",
"padding": "0",
"margin": "0"
}).children().css({
"height": e
});
break;
case "left":
aa.wrap('').css({
"width": e * f,
"left": -(k * ac) * f,
"position": "relative",
"overflow": "hidden",
"padding": "0",
"margin": "0"
}).children().css({
"float": "left",
"width": q
});
break;
case "leftloop":
case "leftmarquee":
w();
aa.wrap('').css({
"width": (e + ag + r) * f,
"position": "relative",
"overflow": "hidden",
"padding": "0",
"margin": "0",
"left": -(r + k * ac) * f
}).children().css({
"float": "left",
"width": q
});
break;
case "toploop":
case "topmarquee":
w();
aa.wrap('').css({
"height": (e + ag + r) * j,
"position": "relative",
"padding": "0",
"margin": "0",
"top": -(r + k * ac) * j
}).children().css({
"height": e
});
break
}
}
var z = function(ar) {
var i = ar * ac;
if (ar == m) {
i = e
} else {
if (ar == -1 && e % ac != 0) {
i = -e % ac
}
}
return i
};
var d = function(aw) {
var av = function(ay) {
for (var ax = ay; ax < (ag + ay); ax++) {
aw.eq(ax).find("img[" + h + "]").each(function() {
var ab = a(this);
ab.attr("src", ab.attr(h)).removeattr(h);
if (aa.find(".clone")[0]) {
var aa = aa.children();
for (var az = 0; az < aa.size(); az++) {
aa.eq(az).find("img[" + h + "]").each(function() {
if (a(this).attr(h) == ab.attr("src")) {
a(this).attr("src", a(this).attr(h)).removeattr(h)
}
})
}
}
})
}
};
switch (af) {
case "fade":
case "fold":
case "top":
case "left":
case "slidedown":
av(k * ac);
break;
case "leftloop":
case "toploop":
av(r + z(am));
break;
case "leftmarquee":
case "topmarquee":
var at = af == "leftmarquee" ? aa.css("left").replace("px", "") : aa.css("top").replace("px", "");
var ar = af == "leftmarquee" ? f : j;
var i = r;
if (at % ar != 0) {
var au = math.abs(at / ar ^ 0);
if (k == 1) {
i = r + au
} else {
i = r + au - 1
}
}
av(i);
break
}
};
var o = function(au) {
if (x && ao == k && !au && !u) {
return
}
if (u) {
if (k >= 1) {
k = 1
} else {
if (k <= 0) {
k = 0
}
}
} else {
am = k;
if (k >= m) {
k = 0
} else {
if (k < 0) {
k = m - 1
}
}
}
al();
if (h != null) {
d(aa.children())
}
if (ai[0]) {
v = ai.eq(k);
if (h != null) {
d(ai)
}
if (af == "slidedown") {
ai.not(v).stop(true, true).slideup(z);
v.slidedown(z, r, function() {
if (!aa[0]) {
j()
}
})
} else {
ai.not(v).stop(true, true).hide();
v.animate({
opacity: "show"
}, z, function() {
if (!aa[0]) {
j()
}
})
}
}
if (e >= ag) {
switch (af) {
case "fade":
aa.children().stop(true, true).eq(k).animate({
opacity: "show"
}, z, r, function() {
j()
}).siblings().hide();
break;
case "fold":
aa.children().stop(true, true).eq(k).animate({
opacity: "show"
}, z, r, function() {
j()
}).siblings().animate({
opacity: "hide"
}, z, r);
break;
case "top":
aa.stop(true, false).animate({
"top": -k * ac * j
}, z, r, function() {
j()
});
break;
case "left":
aa.stop(true, false).animate({
"left": -k * ac * f
}, z, r, function() {
j()
});
break;
case "leftloop":
var ar = am;
aa.stop(true, true).animate({
"left": -(z(am) + r) * f
}, z, r, function() {
if (ar <= -1) {
aa.css("left", -(r + (m - 1) * ac) * f)
} else {
if (ar >= m) {
aa.css("left", -r * f)
}
}
j()
});
break;
case "toploop":
var ar = am;
aa.stop(true, true).animate({
"top": -(z(am) + r) * j
}, z, r, function() {
if (ar <= -1) {
aa.css("top", -(r + (m - 1) * ac) * j)
} else {
if (ar >= m) {
aa.css("top", -r * j)
}
}
j()
});
break;
case "leftmarquee":
var at = aa.css("left").replace("px", "");
if (k == 0) {
aa.animate({
"left": ++at
}, 0, function() {
if (aa.css("left").replace("px", "") >= 0) {
aa.css("left", -e * f)
}
})
} else {
aa.animate({
"left": --at
}, 0, function() {
if (aa.css("left").replace("px", "") <= -(e + r) * f) {
aa.css("left", -r * f)
}
})
}
break;
case "topmarquee":
var i = aa.css("top").replace("px", "");
if (k == 0) {
aa.animate({
"top": ++i
}, 0, function() {
if (aa.css("top").replace("px", "") >= 0) {
aa.css("top", -e * j)
}
})
} else {
aa.animate({
"top": --i
}, 0, function() {
if (aa.css("top").replace("px", "") <= -(e + r) * j) {
aa.css("top", -r * j)
}
})
}
break
}
}
b.removeclass(ap).eq(k).addclass(ap);
ao = k;
if (!p) {
h.removeclass("nextstop");
o.removeclass("prevstop");
if (k == 0) {
o.addclass("prevstop")
}
if (k == m - 1) {
h.addclass("nextstop")
}
}
g.html("" + "0" + (k + 1) + "/" + "" + "0" + m + "")
};
if (x) {
o(true)
}
if (q) {
g.hover(function() {
cleartimeout(w)
}, function() {
w = settimeout(function() {
k = f;
if (x) {
o()
} else {
if (af == "slidedown") {
v.slideup(z, c)
} else {
v.animate({
opacity: "hide"
}, z, c)
}
}
ao = k
}, 300)
})
}
var t = function(i) {
ad = setinterval(function() {
c ? k-- : k++;
o()
}, !!i ? i : p)
};
var u = function(i) {
ad = setinterval(o, !!i ? i : p)
};
var a = function() {
if (!ae && ab && !n.hasclass("pausestate")) {
clearinterval(ad);
t()
}
};
var y = function() {
if (p || k != m - 1) {
k++;
o();
if (!u) {
a()
}
}
};
var v = function() {
if (p || k != 0) {
k--;
o();
if (!u) {
a()
}
}
};
var t = function() {
clearinterval(ad);
u ? u() : t();
n.removeclass("pausestate")
};
var aj = function() {
clearinterval(ad);
n.addclass("pausestate")
};
if (ab) {
if (u) {
c ? k-- : k++;
u();
if (ae) {
aa.hover(aj, t)
}
} else {
t();
if (ae) {
g.hover(aj, t)
}
}
} else {
if (u) {
c ? k-- : k++
}
n.addclass("pausestate")
}
n.click(function() {
n.hasclass("pausestate") ? t() : aj()
});
if (i.trigger == "mouseover") {
b.hover(function() {
var i = b.index(this);
m = settimeout(function() {
k = i;
o();
a()
}, i.triggertime)
}, function() {
cleartimeout(m)
})
} else {
b.click(function() {
k = b.index(this);
o();
a()
})
}
if (u) {
h.mousedown(y);
o.mousedown(v);
if (p) {
var n;
var k = function() {
n = settimeout(function() {
clearinterval(ad);
u(p / 10 ^ 0)
}, 150)
};
var ah = function() {
cleartimeout(n);
clearinterval(ad);
u()
};
h.mousedown(k);
h.mouseup(ah);
o.mousedown(k);
o.mouseup(ah)
}
if (i.trigger == "mouseover") {
h.hover(y, function() {});
o.hover(v, function() {})
}
} else {
h.click(y);
o.click(v)
}
if (i.vis == "auto" && ac == 1 && (af == "left" || af == "leftloop")) {
var x;
var l = function() {
if (an) {
aa.width("auto");
aa.children().width("auto")
}
aa.parent().width("auto");
f = aa.parent().width();
if (an) {
aa.parent().width(f)
}
aa.children().width(f);
if (af == "left") {
aa.width(f * e);
aa.stop(true, false).animate({
"left": -k * f
}, 0)
} else {
aa.width(f * (e + 2));
aa.stop(true, false).animate({
"left": -(k + 1) * f
}, 0)
}
if (!an && (f != aa.parent().width())) {
l()
}
};
a(window).resize(function() {
cleartimeout(x);
x = settimeout(l, 100)
});
l()
}
})
}
}
)(jquery);
jquery.easing["jswing"] = jquery.easing["swing"];
jquery.extend(jquery.easing, {
def: "easeoutquad",
swing: function(e, f, a, h, g) {
return jquery.easing[jquery.easing.def](e, f, a, h, g)
},
easeinquad: function(e, f, a, h, g) {
return h * (f /= g) * f + a
},
easeoutquad: function(e, f, a, h, g) {
return -h * (f /= g) * (f - 2) + a
},
easeinoutquad: function(e, f, a, h, g) {
if ((f /= g / 2) < 1) {
return h / 2 * f * f + a
}
return -h / 2 * ((--f) * (f - 2) - 1) + a
},
easeincubic: function(e, f, a, h, g) {
return h * (f /= g) * f * f + a
},
easeoutcubic: function(e, f, a, h, g) {
return h * ((f = f / g - 1) * f * f + 1) + a
},
easeinoutcubic: function(e, f, a, h, g) {
if ((f /= g / 2) < 1) {
return h / 2 * f * f * f + a
}
return h / 2 * ((f -= 2) * f * f + 2) + a
},
easeinquart: function(e, f, a, h, g) {
return h * (f /= g) * f * f * f + a
},
easeoutquart: function(e, f, a, h, g) {
return -h * ((f = f / g - 1) * f * f * f - 1) + a
},
easeinoutquart: function(e, f, a, h, g) {
if ((f /= g / 2) < 1) {
return h / 2 * f * f * f * f + a
}
return -h / 2 * ((f -= 2) * f * f * f - 2) + a
},
easeinquint: function(e, f, a, h, g) {
return h * (f /= g) * f * f * f * f + a
},
easeoutquint: function(e, f, a, h, g) {
return h * ((f = f / g - 1) * f * f * f * f + 1) + a
},
easeinoutquint: function(e, f, a, h, g) {
if ((f /= g / 2) < 1) {
return h / 2 * f * f * f * f * f + a
}
return h / 2 * ((f -= 2) * f * f * f * f + 2) + a
},
easeinsine: function(e, f, a, h, g) {
return -h * math.cos(f / g * (math.pi / 2)) + h + a
},
easeoutsine: function(e, f, a, h, g) {
return h * math.sin(f / g * (math.pi / 2)) + a
},
easeinoutsine: function(e, f, a, h, g) {
return -h / 2 * (math.cos(math.pi * f / g) - 1) + a
},
easeinexpo: function(e, f, a, h, g) {
return (f == 0) ? a : h * math.pow(2, 10 * (f / g - 1)) + a
},
easeoutexpo: function(e, f, a, h, g) {
return (f == g) ? a + h : h * (-math.pow(2, -10 * f / g) + 1) + a
},
easeinoutexpo: function(e, f, a, h, g) {
if (f == 0) {
return a
}
if (f == g) {
return a + h
}
if ((f /= g / 2) < 1) {
return h / 2 * math.pow(2, 10 * (f - 1)) + a
}
return h / 2 * (-math.pow(2, -10 * --f) + 2) + a
},
easeincirc: function(e, f, a, h, g) {
return -h * (math.sqrt(1 - (f /= g) * f) - 1) + a
},
easeoutcirc: function(e, f, a, h, g) {
return h * math.sqrt(1 - (f = f / g - 1) * f) + a
},
easeinoutcirc: function(e, f, a, h, g) {
if ((f /= g / 2) < 1) {
return -h / 2 * (math.sqrt(1 - f * f) - 1) + a
}
return h / 2 * (math.sqrt(1 - (f -= 2) * f) + 1) + a
},
easeinelastic: function(f, h, e, l, k) {
var i = 1.70158;
var j = 0;
var g = l;
if (h == 0) {
return e
}
if ((h /= k) == 1) {
return e + l
}
if (!j) {
j = k * 0.3
}
if (g < math.abs(l)) {
g = l;
var i = j / 4
} else {
var i = j / (2 * math.pi) * math.asin(l / g)
}
return -(g * math.pow(2, 10 * (h -= 1)) * math.sin((h * k - i) * (2 * math.pi) / j)) + e
},
easeoutelastic: function(f, h, e, l, k) {
var i = 1.70158;
var j = 0;
var g = l;
if (h == 0) {
return e
}
if ((h /= k) == 1) {
return e + l
}
if (!j) {
j = k * 0.3
}
if (g < math.abs(l)) {
g = l;
var i = j / 4
} else {
var i = j / (2 * math.pi) * math.asin(l / g)
}
return g * math.pow(2, -10 * h) * math.sin((h * k - i) * (2 * math.pi) / j) + l + e
},
easeinoutelastic: function(f, h, e, l, k) {
var i = 1.70158;
var j = 0;
var g = l;
if (h == 0) {
return e
}
if ((h /= k / 2) == 2) {
return e + l
}
if (!j) {
j = k * (0.3 * 1.5)
}
if (g < math.abs(l)) {
g = l;
var i = j / 4
} else {
var i = j / (2 * math.pi) * math.asin(l / g)
}
if (h < 1) {
return -0.5 * (g * math.pow(2, 10 * (h -= 1)) * math.sin((h * k - i) * (2 * math.pi) / j)) + e
}
return g * math.pow(2, -10 * (h -= 1)) * math.sin((h * k - i) * (2 * math.pi) / j) * 0.5 + l + e
},
easeinback: function(e, f, a, i, h, g) {
if (g == undefined) {
g = 1.70158
}
return i * (f /= h) * f * ((g + 1) * f - g) + a
},
easeoutback: function(e, f, a, i, h, g) {
if (g == undefined) {
g = 1.70158
}
return i * ((f = f / h - 1) * f * ((g + 1) * f + g) + 1) + a
},
easeinoutback: function(e, f, a, i, h, g) {
if (g == undefined) {
g = 1.70158
}
if ((f /= h / 2) < 1) {
return i / 2 * (f * f * (((g *= (1.525)) + 1) * f - g)) + a
}
return i / 2 * ((f -= 2) * f * (((g *= (1.525)) + 1) * f + g) + 2) + a
},
easeinbounce: function(e, f, a, h, g) {
return h - jquery.easing.easeoutbounce(e, g - f, 0, h, g) + a
},
easeoutbounce: function(e, f, a, h, g) {
if ((f /= g) < (1 / 2.75)) {
return h * (7.5625 * f * f) + a
} else {
if (f < (2 / 2.75)) {
return h * (7.5625 * (f -= (1.5 / 2.75)) * f + 0.75) + a
} else {
if (f < (2.5 / 2.75)) {
return h * (7.5625 * (f -= (2.25 / 2.75)) * f + 0.9375) + a
} else {
return h * (7.5625 * (f -= (2.625 / 2.75)) * f + 0.984375) + a
}
}
}
},
easeinoutbounce: function(e, f, a, h, g) {
if (f < g / 2) {
return jquery.easing.easeinbounce(e, f * 2, 0, h, g) * 0.5 + a
}
return jquery.easing.easeoutbounce(e, f * 2 - g, 0, h, g) * 0.5 + h * 0.5 + a
}
});