!function($) { $.fn.sudyslide = function(opts) { var defaults = { p:null, json:[], title:{ active:!0, isAutoWidth:!1, href:!1 }, text:{ active:!1, isAutoHeight:!1, href:!1 }, mask:{ active:!0, color:"#000", opacity:.8 }, thumb:!0, href:!0, zWidth:1e3, zHeight:400, interval:5e3, animateTime:500, isNavHover:!0, auto:!0, pagination:!0, start:1 }, o = $.extend(!0, {}, defaults, opts), zW = o.zWidth, zH = o.zHeight, r = zW / zH; return null !== o.p && "function" == eval("typeof getImgJson") && (o.json = getImgJson(o.p).concat(o.json)), this.each(function() { function n(a) { g.add(h).hide(); var b = $.trim(o.json[a].title || ""), c = $.trim(o.json[a].text || ""), $url = $.trim(o.json[a].url || ""); if(/^无标题/.test(b)) b = ""; if(/^#|javascript:void\(0\)/.test($url)) $url = ""; if ("" !== $url) { var d = $(''); o.href && e.eq(a).find("a").length < 1 && e.eq(a).wrapInner(d), o.title.href && "" !== b && (b = d.clone().html(b)), o.text.href && "" !== c && (c = d.clone().html(c)); } "" !== b && (g.show(), l.html(b)), "" !== c && (h.show(), m.html(c)), o.title.isAutoWidth && l.parent().css("width", l.outerWidth()), o.text.isAutoHeight && m.parent().parent().css("height", m.outerHeight()), thumb.removeClass("thumb-active").eq(a).addClass("thumb-active"); } var a = $(this), b = a.children(), c = []; if ($.each(b, function(a, b) { var d = {}; d.title = $(b).attr("data-title") || "", d.url = $(b).attr("data-url") || "", d.text = $(b).attr("data-text") || "", d.src = $(b).attr("data-src") || "", c.push(d); }), o.json = c.concat(o.json), o.json.length < 1) return a.html('Sudyslide Error: Not Found Data, Need to Bind!'); a.html(function(a, b) { return b = "", $.each(o.json, function() { b += ''; }), b; }), a.children().wrap('
').end().wrapInner('
'); var d = $(".slide-container", a), e = $(".slide-item", d), f = e.length; o.title.active && $('

').appendTo(a), o.text.active && $('

').appendTo(a), o.mask && ($('
').appendTo(a), d.css("overflow", "visible")), o.thumb && $('
').html(function(a, b) { return $.each(o.json, function() { b += ''; }), b; }).appendTo(a), f > 1 && $('<>').appendTo(a); var g = $(".slide-title-bar", a), h = $(".slide-text-box", a), i = $(".slide-navigation", a), k = ($(".slide-mask", a).css({ "background-color":o.mask.color, opacity:o.mask.opacity }), $(".slide-thumb", a)), l = $(".slide-title", g), m = $(".slide-text", h); prev = $(".slide-prev", a), next = $(".slide-next", a), thumb = $(".thumb-image", k), o.isNavHover && (i.hide(), a.hover(function() { i.show(); }, function() { i.hide(); })), a.css({ width:zW + "px", height:zH + "px" }).addClass("slide-wrap").wrap('
'), d.css({ width:zW + "px", height:zH + "px" }); var p = o.start - 1; e.eq(p).css("left", 0).end().eq(p + 1).css("left", zW).end().eq(p - 1).css("left", -zW), n(p); var q = function(a) { return p + a >= f ? p + a - f :p + a; }, r = function(a) { return 0 > p - a ? f + p - a :p - a; }, s = function(a) { e.eq(a ? r(2) :q(2)).css("left", a ? -2 * zW :2 * zW), e.animate({ left:(a ? "+=" :"-=") + zW }, o.animateTime), p = a ? r(1) :q(1), n(p); }; if (o.auto) { var t = setInterval(function() { s(!1); }, o.interval); a.hover(function() { clearInterval(t); }, function() { t = setInterval(function() { s(!1); }, o.interval); }); } prev.click(function() { 0 === $(":animated").length && s(!0); }), next.click(function() { 0 === $(":animated").length && s(!1); }); }); }; }(jQuery);