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("
") } for (var i = 0; i < total; i++) { $(".slider-buttons", g).append("") } $(".slider-buttons a").each(function(i) { $(this).on("click", function() { cleartimeout(_t); doslider(i, true) }) }); if (!f.control) $(".slider-buttons", g).remove(); _slider = $(".slider-box", g); $(g).css("height", a + "px"); $(".slider-box", g).css("height", a + "px"); _w = $(g).width(); $(".slider-item", g).css("height", a + "px"); $(window).bind("resize", function() { $(".slider-box", g).css("margin-left", math.floor(($(g).width() - $(".slider-box", g).width()) / 2) + "px") }); doslider() } function loadimage(a, b) { var c = new image(); c.src = a; if (c.complete) { b.call(); return } c.onload = function() { b() } } } }); /* * jquery easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ * * uses the built in easing capabilities added in jquery 1.1 * to offer multiple easing options * * terms of use - jquery easing * * open source under the bsd license. * * copyright © 2008 george mcginley smith * all rights reserved. * * redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * this software is provided by the copyright holders and contributors "as is" and any * express or implied warranties, including, but not limited to, the implied warranties of * merchantability and fitness for a particular purpose are disclaimed. in no event shall the * copyright owner or contributors be liable for any direct, indirect, incidental, special, * exemplary, or consequential damages (including, but not limited to, procurement of substitute * goods or services; loss of use, data, or profits; or business interruption) however caused * and on any theory of liability, whether in contract, strict liability, or tort (including * negligence or otherwise) arising in any way out of the use of this software, even if advised * of the possibility of such damage. * */ // t: current time, b: beginning value, c: change in value, d: duration jquery.easing['jswing'] = jquery.easing['swing']; jquery.extend( jquery.easing, { def: 'easeoutquad', swing: function (x, t, b, c, d) { //alert(jquery.easing.default); return jquery.easing[jquery.easing.def](x, t, b, c, d); }, easeinquad: function (x, t, b, c, d) { return c*(t/=d)*t + b; }, easeoutquad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, easeinoutquad: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t + b; return -c/2 * ((--t)*(t-2) - 1) + b; }, easeincubic: function (x, t, b, c, d) { return c*(t/=d)*t*t + b; }, easeoutcubic: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; }, easeinoutcubic: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t + b; return c/2*((t-=2)*t*t + 2) + b; }, easeinquart: function (x, t, b, c, d) { return c*(t/=d)*t*t*t + b; }, easeoutquart: function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, easeinoutquart: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t + b; return -c/2 * ((t-=2)*t*t*t - 2) + b; }, easeinquint: function (x, t, b, c, d) { return c*(t/=d)*t*t*t*t + b; }, easeoutquint: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t*t*t + 1) + b; }, easeinoutquint: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; return c/2*((t-=2)*t*t*t*t + 2) + b; }, easeinsine: function (x, t, b, c, d) { return -c * math.cos(t/d * (math.pi/2)) + c + b; }, easeoutsine: function (x, t, b, c, d) { return c * math.sin(t/d * (math.pi/2)) + b; }, easeinoutsine: function (x, t, b, c, d) { return -c/2 * (math.cos(math.pi*t/d) - 1) + b; }, easeinexpo: function (x, t, b, c, d) { return (t==0) ? b : c * math.pow(2, 10 * (t/d - 1)) + b; }, easeoutexpo: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-math.pow(2, -10 * t/d) + 1) + b; }, easeinoutexpo: function (x, t, b, c, d) { if (t==0) return b; if (t==d) return b+c; if ((t/=d/2) < 1) return c/2 * math.pow(2, 10 * (t - 1)) + b; return c/2 * (-math.pow(2, -10 * --t) + 2) + b; }, easeincirc: function (x, t, b, c, d) { return -c * (math.sqrt(1 - (t/=d)*t) - 1) + b; }, easeoutcirc: function (x, t, b, c, d) { return c * math.sqrt(1 - (t=t/d-1)*t) + b; }, easeinoutcirc: function (x, t, b, c, d) { if ((t/=d/2) < 1) return -c/2 * (math.sqrt(1 - t*t) - 1) + b; return c/2 * (math.sqrt(1 - (t-=2)*t) + 1) + b; }, easeinelastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*math.pi) * math.asin (c/a); return -(a*math.pow(2,10*(t-=1)) * math.sin( (t*d-s)*(2*math.pi)/p )) + b; }, easeoutelastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*math.pi) * math.asin (c/a); return a*math.pow(2,-10*t) * math.sin( (t*d-s)*(2*math.pi)/p ) + c + b; }, easeinoutelastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); if (a < math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*math.pi) * math.asin (c/a); if (t < 1) return -.5*(a*math.pow(2,10*(t-=1)) * math.sin( (t*d-s)*(2*math.pi)/p )) + b; return a*math.pow(2,-10*(t-=1)) * math.sin( (t*d-s)*(2*math.pi)/p )*.5 + c + b; }, easeinback: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*(t/=d)*t*((s+1)*t - s) + b; }, easeoutback: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; }, easeinoutback: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; }, easeinbounce: function (x, t, b, c, d) { return c - jquery.easing.easeoutbounce (x, d-t, 0, c, d) + b; }, easeoutbounce: function (x, t, b, c, d) { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; } else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; } else { return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; } }, easeinoutbounce: function (x, t, b, c, d) { if (t < d/2) return jquery.easing.easeinbounce (x, t*2, 0, c, d) * .5 + b; return jquery.easing.easeoutbounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; } }); /* * * terms of use - easing equations * * open source under the bsd license. * * copyright © 2001 robert penner * all rights reserved. * * redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * this software is provided by the copyright holders and contributors "as is" and any * express or implied warranties, including, but not limited to, the implied warranties of * merchantability and fitness for a particular purpose are disclaimed. in no event shall the * copyright owner or contributors be liable for any direct, indirect, incidental, special, * exemplary, or consequential damages (including, but not limited to, procurement of substitute * goods or services; loss of use, data, or profits; or business interruption) however caused * and on any theory of liability, whether in contract, strict liability, or tort (including * negligence or otherwise) arising in any way out of the use of this software, even if advised * of the possibility of such damage. * */