﻿$(function () { var a = $("#pxs_container"); a.parallaxSlider() }); (function (e) { e.fn.parallaxSlider = function (g) { var h = e.extend({}, e.fn.parallaxSlider.defaults, g); return this.each(function () { var s = e(this), A = e.meta ? e.extend({}, h, s.data()) : h; var y = e(".pxs_slider_wrapper", s), l = e(".pxs_slider", s), x = l.children(), J = x.length, w = l.find("img"); var q = e('<ul class="pxs_titles"></ul>'); y.append(q); for (var E = 0; E < J; E++) { $Titles = w.eq(E).attr("titles"); $Tstyle = w.eq(E).attr("tstyle"); $Tlink = w.eq(E).attr("tlink"); q.append('<li><a href="' + $Tlink + '"><img src="' + $Titles + '" style="' + $Tstyle + '" /></a></li>') } var v = e(".pxs_titles", s), t = v.children(), p = t.length, z = y.find("img"); var m = e('<div class="pxs_thumbnav"></div>'); y.append(m); m.append('<span class="pxs_prev"></span>'); var r = e('<div class="pxs_thumbnails"></div>'); m.append(r); m.append('<span class="pxs_next"></span>'); for (var F = 0; F < J; F++) { $contatore = F + 1; r.append("<a>" + $contatore + "</a>") } var I = e(".pxs_next", s), K = e(".pxs_thumbnav", s), H = e(".pxs_prev", s), G = e(".pxs_bg1", s), B = 0, C = e(".pxs_thumbnails", s), n = C.children(), u, k = e(".pxs_loading", s); var D = 0; z.each(function () { var i = e(this); e("<img/>").load(function () { ++D; if (D == J * 2) { $currentimg = w.eq(B).attr("back"); s.animate({ height: "400px" }, 400); k.hide(); y.show(); l.show(); v.show(); K.css({ width: 20 * n.length + 50 + "px" }); K.show(); G.fadeOut("fast", function () { e(this).css("backgroundImage", "url(" + $currentimg + ")"); e(this).fadeIn(800) }); var j = l.find("img:first").width(); d(l, v, x, t, J, j); c(n.eq(0)); I.bind("click", function () { ++B; if (B >= J) { if (A.circular) { B = 0 } else { --B; return false } } $currentimg = w.eq(B).attr("back"); f(G, $currentimg); c(n.eq(B)); a(B, l, v, A.speed, A.easing, A.easingBg) }); H.bind("click", function () { --B; if (B < 0) { if (A.circular) { B = J - 1 } else { ++B; return false } } $currentimg = w.eq(B).attr("back"); f(G, $currentimg); c(n.eq(B)); a(B, l, v, A.speed, A.easing, A.easingBg) }); n.bind("click", function () { var o = e(this); c(o); if (A.auto) { clearInterval(u) } B = o.index(); a(B, l, v, A.speed, A.easing, A.easingBg); $currentimg = w.eq(B).attr("back"); f(G, $currentimg) }); if (A.auto != 0) { A.circular = false; u = setInterval(function () { I.trigger("click") }, A.auto) } e(window).resize(function () { b = e(window).width(); d(l, v, x, t, J, j); a(B, l, v, 1, A.easing, A.easingBg) }) } }).error(function () { alert("here") }).attr("src", i.attr("src")) }) }) }; var b = e(window).width(); var f = function (g, h) { g.fadeOut("fast", function () { e(this).css("backgroundImage", "url(" + h + ")"); e(this).fadeIn("fast") }) }; var a = function (l, k, g, j, n, i) { var m = parseInt(-b * l); var h = parseInt(-b); k.stop().animate({ left: m + "px" }, j, n); g.stop().animate({ left: m + "px" }, j, i) }; var c = function (g) { g.siblings().removeClass("selected"); g.addClass("selected") }; var d = function (l, h, m, i, j, g) { var k = b * j; l.width(k + "px"); h.width(k + "px"); m.width(b + "px"); i.width(b + "px") }; e.fn.parallaxSlider.defaults = { auto: 7000, speed: 1500, easing: "jswing", easingBg: "easeOutQuint", circular: false, thumbRotation: false} })(jQuery); jQuery.extend({ BgImageTransitions: [] }); jQuery.fn.extend({ BgImageTransition: function (e, b) { if (!e) { return jQuery } if (!this.css("zIndex")) { this.css("zIndex", 1) } var c = jQuery.extend({ effect: { opacity: "toggle" }, duration: "slow", easing: "linear", callback: function () { }, helperElementId: this.attr("id") + "2", zindex: parseInt(this.css("zIndex"), 10) + 1 }, b); var a = null; if (!jQuery.BgImageTransitions[this.attr("id")]) { a = this.clone(); a.css("zIndex", c.zindex); a.css("display", "none"); a.attr("id", c.helperElementId); a.insertAfter(this); jQuery.BgImageTransitions[this.attr("id")] = a } else { a = jQuery.BgImageTransitions[this.attr("id")] } var d = new Image(); jQuery(d).load(function () { var f = (a.css("display") == "block") ? jQuery(this) : jQuery(a); f.css("backgroundImage", "url(" + d.src + ")"); a.animate(c.effect, c.duration, c.easing, c.callback) }); d.src = e; return 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) }, easeOutQuint: function (e, f, a, h, g) { return h * ((f = f / g - 1) * f * f * f * f + 1) + a } });
