jquery.fn.extend({ islider: function(d) { var e = { speed: 1960, delay: 2000, transition: "random", caption: true, control: true }; var f = $.extend(e, d); var g = this, _slider, _w, _h, _t, total, items = 18, type = f.transition, _b; total = $("li", g).length; $(g).addclass("ibanner"); $("ul", g).wrap("
"); loadimage($("li:first img", g).attr("src"), function() { h = $("li:first img", g).height(); _init(h) }); function doslider(a, b) { if (a == undefined) a = 0; if (a >= total) a = 0; w = $("li:eq(" + a + ") img", g).width(); h = $("li:eq(" + a + ") img", g).height(); $(".slider-box", g).css({ "margin-left": math.floor(($(g).width() - w) / 2) + "px", "width": w + "px" }).find("a:first").attr("href", $("li:eq(" + a + ") a", g).attr("href")); $(".slider-buttons a:eq(" + a + ")", g).addclass("active").siblings(".active").removeclass("active"); if (f.caption) { $(".slider-caption", g).css("margin-left", 0).html($("li:eq(" + a + ") img", g).attr("alt")).animate({ "margin-left": ($("li:eq(" + a + ") img", g).attr("alt") == "" ? 0 : -$(".slider-caption", g).outerwidth(true)) + "px" }, f.speed, "easeinoutexpo") } if (type == "random") { types = ["fade", "up", "left", "down", "blinds", "blindsup", "blindsdown", "blindsuprandom", "blindsdownrandom", "blindsrandom", "blindsxrandom", "puzzle", "swape"]; type = types[math.round((types.length * math.random()))] } if (b == undefined) { $(".slider-item", g).each(function(i) { $(this).css({ "left": math.ceil(w / items) * i + "px", "width": math.ceil(w / items) + "px", "background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-math.ceil(w / items) * i) + "px" + " 0" }) }); b = true } else { switch (type) { case "fade": $(".slider-item", g).each(function(i) { $(this).css({ "opacity": 0, "left": math.ceil(w / items) * i + "px", "width": math.ceil(w / items) + "px", "background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-math.ceil(w / items) * i) + "px" + " 0" }).stop().animate({ opacity: 1 }, f.speed) }); break; case "up": $(".slider-item", g).each(function(i) { $(this).css({ "opacity": 0, "left": math.ceil(w / items) * i + "px", "margin-top": h + "px", "width": math.ceil(w / items) + "px", "background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-math.ceil(w / items) * i) + "px" + " 0" }).stop().animate({ margintop: 0, opacity: 1 }, f.speed, "easeinoutexpo") }); break; case "left": $(".slider-item", g).each(function(i) { $(this).css({ "opacity": 0, "left": math.ceil(w / items) * i + "px", "margin-left": w + "px", "width": math.ceil(w / items) + "px", "background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-math.ceil(w / items) * i) + "px" + " 0" }).stop().animate({ marginleft: 0, opacity: 1 }, f.speed, "easeinoutexpo") }); break; case "down": $(".slider-item", g).each(function(i) { $(this).css({ "opacity": 0, "left": math.ceil(w / items) * i + "px", "margin-top": -h + "px", "background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-math.ceil(w / items) * i) + "px" + " 0" }).stop().animate({ margintop: 0, opacity: 1 }, f.speed, "easeinoutexpo") }); break; case "blinds": $(".slider-item", g).each(function(i) { $(this).css({ "opacity": 0, "left": math.ceil(w / items) * i + "px", "width": math.ceil(w / items) + "px", "background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-math.ceil(w / items) * i) + "px" + " 0" }).stop().delay(60 * i).animate({ opacity: 1 }, f.speed - 60 * items, "easeinoutexpo") }); break; case "blindsup": $(".slider-item", g).each(function(i) { $(this).css({ "opacity": 0, "left": math.ceil(w / items) * i + "px", "margin-top": h + "px", "width": math.ceil(w / items) + "px", "background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-math.ceil(w / items) * i) + "px" + " 0" }).stop().delay(60 * i).animate({ opacity: 1, margintop: 0 }, f.speed - 60 * items, "easeinoutexpo") }); break; case "blindsdown": $(".slider-item", g).each(function(i) { $(this).css({ "opacity": 0, "left": math.ceil(w / items) * i + "px", "margin-top": -h + "px", "width": math.ceil(w / items) + "px", "background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-math.ceil(w / items) * i) + "px" + " 0" }).stop().delay(60 * i).animate({ opacity: 1, margintop: 0 }, f.speed - 60 * items, "easeinoutexpo") }); break; case "blindsuprandom": $(".slider-item", g).each(function(i) { $(this).css({ "opacity": 0, "left": math.ceil(w / items) * i + "px", "margin-top": h * math.random() + "px", "width": math.ceil(w / items) + "px", "background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-math.ceil(w / items) * i) + "px" + " 0" }).stop().animate({ opacity: 1, margintop: 0 }, f.speed, "easeinoutexpo") }); break; case "blindsdownrandom": $(".slider-item", g).each(function(i) { $(this).css({ "opacity": 0, "left": math.ceil(w / items) * i + "px", "margin-top": -(h * math.random()) + "px", "width": math.ceil(w / items) + "px", "background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-math.ceil(w / items) * i) + "px" + " 0" }).stop().animate({ opacity: 1, margintop: 0 }, f.speed, "easeinoutexpo") }); break; case "blindsrandom": $(".slider-item", g).each(function(i) { $(this).css({ "opacity": 0, "left": math.ceil(w / items) * i + "px", "margin-top": h * math.random() * (math.random() > .5 ? 1 : -1) + "px", "width": math.ceil(w / items) + "px", "background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-math.ceil(w / items) * i) + "px" + " 0" }).stop().animate({ opacity: 1, margintop: 0 }, f.speed, "easeinoutexpo") }); break; case "blindsxrandom": $(".slider-item", g).each(function(i) { $(this).css({ "opacity": 0, "left": math.ceil(w / items) * i + "px", "margin-left": w * math.random() * (math.random() > .5 ? 1 : -1) + "px", "width": math.ceil(w / items) + "px", "background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-math.ceil(w / items) * i) + "px" + " 0" }).stop().animate({ opacity: 1, marginleft: 0 }, f.speed, "easeinoutexpo") }); break; case "puzzle": $(".slider-item", g).each(function(i) { $(this).css({ "opacity": 0, "left": math.ceil(w / items) * i + "px", "margin-top": h * math.random() * (math.random() > .5 ? 1 : -1) * 2 + "px", "margin-left": w * math.random() * (math.random() > .5 ? 1 : -1) + "px", "width": math.ceil(w / items) + "px", "background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-math.ceil(w / items) * i) + "px" + " 0" }).stop().animate({ opacity: 1, margintop: 0, marginleft: 0 }, f.speed, "easeinoutexpo") }); break; case "swape": $(".slider-item", g).each(function(i) { $(this).css({ "opacity": 0, "left": math.ceil(w / items) * i + "px", "width": 0, "background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-math.ceil(w / items) * i) + "px" + " 0" }).stop().delay(60 * i).animate({ opacity: 1, "width": math.ceil(w / items) + "px" }, f.speed - 60 * items, "easeinoutexpo") }); break } } $(".slider-process", g).stop().css("width", 0).animate({ "width": "100%" }, f.speed + f.delay, "linear"); if (_b) cleartimeout(_b); _b = settimeout(function() { $(g).css("background-image", "url(" + $("li:eq(" + a + ") img", g).attr("src") + ")") }, f.speed); type = f.transition; _t = settimeout(function() { a++; doslider(a, b) }, f.speed + f.delay) } function _init(a) { $(g).append(" "); for (var i = 0; i < items; i++) { $(".slider-box a", g).append("