// 焦点图-01
(function(d, d, v) {
d.fn.responsiveslides = function(h) {
var b = d.extend({
auto: !0,
speed: 1e3,
timeout: 4e3, // 调整切换速度
pager: !1,
nav: !1,
random: !1,
pause: !1,
pausecontrols: !1,
prevtext: "previous",
nexttext: "next",
maxwidth: "",
controls: "",
namespace: "rslides",
before: function() {},
after: function() {}
},
h);
return this.each(function() {
v++;
var e = d(this),
n,
p,
i,
k,
l,
m = 0,
f = e.children(),
w = f.size(),
q = parsefloat(b.speed),
x = parsefloat(b.timeout),
r = parsefloat(b.maxwidth),
c = b.namespace,
g = c + v,
y = c + "-nav " + g + "-nav",
s = c + "-here",
j = g + "-on",
z = g + "-s",
o = d("
"),
a = {
"float": "left",
position: "relative"
},
e = {
"float": "none",
position: "absolute"
},
t = function(a) {
b.before();
f.stop().fadeout(q,
function() {
d(this).removeclass(j).css(e)
}).eq(a).fadein(q,
function() {
d(this).addclass(j).css(a);
b.after();
m = a
})
};
b.random && (f.sort(function() {
return math.round(math.random()) - 0.5
}), e.empty().append(f));
f.each(function(a) {
this.id = z + a
});
e.addclass(c + " " + g);
h && h.maxwidth && e.css("max-width", r);
f.hide().eq(0).addclass(j).css(a).show();
if (1 < f.size()) {
if (x < q + 100) return;
if (b.pager) {
var u = [];
f.each(function(a) {
a = a + 1;
u = u + ("" + a + "")
});
o.append(u);
l = o.find("a");
h.controls ? d(b.controls).append(o) : e.after(o);
n = function(a) {
l.closest("li").removeclass(s).eq(a).addclass(s)
}
}
b.auto && (p = function() {
k = setinterval(function() {
var a = m + 1 < w ? m + 1 : 0;
b.pager && n(a);
t(a)
},
x)
},
p());
i = function() {
if (b.auto) {
clearinterval(k);
p()
}
};
b.pause && e.hover(function() {
clearinterval(k)
},
function() {
i()
});
b.pager && (l.bind("click",
function(a) {
a.preventdefault();
b.pausecontrols || i();
a = l.index(this);
if (! (m === a || d("." + j + ":animated").length)) {
n(a);
t(a)
}
}).eq(0).closest("li").addclass(s), b.pausecontrols && l.hover(function() {
clearinterval(k)
},
function() {
i()
}));
/**如果需要两侧按钮请开放该段代码**/
if (b.nav) {
c = "" + b.prevtext + "" + b.nexttext + "";
h.controls ? d(b.controls).append(c) : e.after(c);
var c = d("." + g + "-nav"),
b = d("." + g + "-nav.prev");
c.bind("click",
function(a) {
a.preventdefault();
if (!d("." + j + ":animated").length) {
var c = f.index(d("." + j)),
a = c - 1,
c = c + 1 < w ? m + 1 : 0;
t(d(this)[0] === b[0] ? a: c);
b.pager && n(d(this)[0] === b[0] ? a: c);
b.pausecontrols || i()
}
});
b.pausecontrols && c.hover(function() {
clearinterval(k)
},
function() {
i()
})
}// 如果需要两侧按钮请开放该段代码
}
if ("undefined" === typeof document.body.style.maxwidth && h.maxwidth) {
var c = function() {
e.css("width", "100%");
e.width() > r && e.css("width", r)
};
c();
d(d).bind("resize",
function() {
c()
})
}
})
}
})(jquery, this, 0);