/*
* Slidorion, An Image Slider and Accordion Combined
* Intructions: http://www.slidorion.com
* Created by Ben Holland - http://www.ben-holland.co.uk
* Version: 1.0
* Copyright 2011 Ben Holland <benholland99@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function (a) { a.fn.extend({ slidorion: function (b) { var c = { autoPlay: true, easing: "", effect: "fade", first: 1, interval: 5000, hoverPause: false, speed: 1000 }; var b = a.extend(c, b); return this.each(function () { var u = b; var w = u.first; var m = u.first + 1; var D = u.speed; var s = u.effect; var n = u.easing; var I = u.interval; var H = u.hoverPause; var A = u.autoPlay; var C = 1; var z = 0; var v = 0; var E = false; var k = false; var B = false; var p = ""; var q = a(this); var y = new Array("fade", "slideLeft", "slideUp", "slideRight", "slideDown", "overLeft", "overRight", "overUp", "overDown"); var j = new Array("slideLeft", "slideUp", "slideRight", "slideDown"); var J = new Array("overLeft", "overRight", "overUp", "overDown"); var l = new Array("wipeDown", "wipeUp"); var i = new Array("wipeDownFade", "wipeUpFade"); var F = new Array("wipeDown", "wipeUp", "wipeDownFade", "wipeUpFade"); z = a("#slider > div", q).size(); q.data("slideCount", z); v = a("#accordion > .link-header", q).size(); q.data("accordCount", v); if (z == v) { if (A == true) { var f = setInterval(function () { d(w, s, D, n) }, I); q.data("interval", f) } if (H == true && A == true) { q.hover(function () { E = true; g(); console.log("here") }, function () { E = false; h(); console.log("here again") }) } x(); a("#slider > div:eq(" + (w - 1) + ")", q).css("z-index", C); C++; if (s != "fade" || s != "none") { a("#slider > div", q).css({ top: "0", left: "-600px" }); a("#slider > div:eq(" + (w - 1) + ")", q).css({ top: "0", left: "0" }) } a(".link-content", q).hide(); a("#accordion .link-header:eq(" + (w - 1) + ")", q).addClass("active").next().show(); a(".link-header", q).click(e) } else { alert("The number of slider images does not match the number of accordion sections."); console.log("The number of slider images does not match the number of accordion sections.") } a(window).load(function () { B = true }); function G(P, O, M, N, o) { if (!k && B) { k = true; if (A == true && E == false) { h() } $current = a("#slider > div:eq(" + (P - 1) + ")", q); $new = a("#slider > div:eq(" + (O - 1) + ")", q); var L = $current.outerWidth(); var Q = $current.outerHeight(); if (M == "random") { var K = Math.floor(Math.random() * y.length); M = y[K]; while (M == p) { var K = Math.floor(Math.random() * y.length); M = y[K] } } else { if (M == "slideRandom") { var K = Math.floor(Math.random() * j.length); M = j[K]; while (M == p) { var K = Math.floor(Math.random() * j.length); M = j[K] } } else { if (M == "overRandom") { var K = Math.floor(Math.random() * J.length); M = J[K]; while (M == p) { var K = Math.floor(Math.random() * J.length); M = J[K] } } } } p = M; switch (M) { case "fade": $new.css({ "z-index": C, top: "0", left: "0", display: "none" }).fadeIn(N); break; case "slideLeft": $new.css({ left: L, top: "0", opacity: "1", "z-index": C }); $current.animate({ left: "-=" + L, top: "0", opacity: "1" }, { queue: true, duration: N, easing: o }); $new.animate({ left: "-=" + L, top: "0", opacity: "1" }, { queue: true, duration: N, easing: o }); break; case "slideRight": $new.css({ left: "-" + L + "px", top: "0", opacity: "1", "z-index": C }); $current.animate({ left: "+=" + L, top: "0", opacity: "1" }, { queue: true, duration: N, easing: o }); $new.animate({ left: "+=" + L, top: "0", opacity: "1" }, { queue: true, duration: N, easing: o }); break; case "slideUp": $new.css({ top: Q, left: "0", opacity: "1", "z-index": C }); $current.animate({ top: "-=" + Q, left: "0", opacity: "1" }, { queue: true, duration: N, easing: o }); $new.animate({ top: "-=" + Q, left: "0", opacity: "1" }, { queue: true, duration: N, easing: o }); break; case "slideDown": $new.css({ top: "-" + Q + "px", left: "0", opacity: "1", "z-index": C }); $current.animate({ top: "+=" + Q, left: "0", opacity: "1" }, { queue: true, duration: N, easing: o }); $new.animate({ top: "+=" + Q, left: "0", opacity: "1" }, { queue: true, duration: N, easing: o }); break; case "overLeft": $new.css({ left: L, top: "0", opacity: "1", "z-index": C }); $new.animate({ left: "-=" + L, top: "0", opacity: "1" }, { queue: true, duration: N, easing: o }); break; case "overRight": $new.css({ left: "-" + L + "px", top: "0", opacity: "1", "z-index": C }); $new.animate({ left: "+=" + L, top: "0", opacity: "1" }, { queue: true, duration: N, easing: o }); break; case "overUp": $new.css({ top: Q, left: "0", opacity: "1", "z-index": C }); $new.animate({ top: "-=" + Q, left: "0", opacity: "1" }, { queue: true, duration: N, easing: o }); break; case "overDown": $new.css({ top: "-" + Q + "px", left: "0", opacity: "1", "z-index": C }); $new.animate({ top: "+=" + Q, left: "0", opacity: "1" }, { queue: true, duration: N, easing: o }); break; case "none": $new.css({ "z-index": C }); break } setTimeout(function () { k = false }, N) } } function e() { if (k == false) { $objHeader = a(this, q); var o = ($objHeader.index() / 2) + 1; if (o == w) { return false } else { a(".link-header.active", q).removeClass("active").next(".link-content").slideUp(); $objHeader.addClass("active").next(".link-content").slideDown(); G(w, o, s, D, n) } C++; w = o; return false } } function d(M, K, L, o) { var N = t(M); a("#accordion .link-header:eq(" + N + ")", q).trigger("click", e) } function r() { f = setInterval(function () { d(w, s, D, n) }, I); q.data("interval", f) } function g() { clearInterval(q.data("interval")) } function h() { clearInterval(q.data("interval")); f = setInterval(function () { d(w, s, D, n) }, I); q.data("interval", f) } function t(o) { if (o == z) { o = 0; return o } else { return o } } function x() { for (var o = z; o > 0; o--) { a("#slider > div:eq(" + (o - 1) + ")", q).css("z-index", C); C++ } } }) } }) })(jQuery);
