//Featured area totator script // // /* Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) * Licensed under the MIT License (LICENSE.txt). * * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. * Thanks to: Seamus Leahy for adding deltaX and deltaY * * Version: 3.0.6 * * Requires: 1.2.2+ */ (function (e) { function r(t) { var n = t || window.event, r = [].slice.call(arguments, 1), i = 0, s = true, o = 0, u = 0; t = e.event.fix(n); t.type = "mousewheel"; if (n.wheelDelta) { i = n.wheelDelta / 120 } if (n.detail) { i = -n.detail / 3 } u = i; if (n.axis !== undefined && n.axis === n.HORIZONTAL_AXIS) { u = 0; o = -1 * i } if (n.wheelDeltaY !== undefined) { u = n.wheelDeltaY / 120 } if (n.wheelDeltaX !== undefined) { o = -1 * n.wheelDeltaX / 120 } r.unshift(t, i, o, u); return (e.event.dispatch || e.event.handle).apply(this, r) } var t = ["DOMMouseScroll", "mousewheel"]; if (e.event.fixHooks) { for (var n = t.length; n; ) { e.event.fixHooks[t[--n]] = e.event.mouseHooks } } e.event.special.mousewheel = { setup: function () { if (this.addEventListener) { for (var e = t.length; e; ) { this.addEventListener(t[--e], r, false) } } else { this.onmousewheel = r } }, teardown: function () { if (this.removeEventListener) { for (var e = t.length; e; ) { this.removeEventListener(t[--e], r, false) } } else { this.onmousewheel = null } } }; e.fn.extend({ mousewheel: function (e) { return e ? this.bind("mousewheel", e) : this.trigger("mousewheel") }, unmousewheel: function (e) { return this.unbind("mousewheel", e) } }) })(jQuery); (function ($) { $.fn.lofJSidernews = function (e) { return this.each(function () { new $.lofSidernews(this, e) }) }; $.lofSidernews = function (e, t) { this.settings = { direction: "", mainItemSelector: "li", navInnerSelector: "ul", navSelector: "li", navigatorEvent: "mouseenter", wapperSelector: ".sliders-wrap-inner", interval: 5e3, auto: false, maxItemDisplay: 3, startItem: 0, navPosition: "vertical", navigatorHeight: 100, navigatorWidth: 310, duration: 600, navItemsSelector: ".navigator-wrap-inner li", navOuterSelector: ".navigator-wrapper", isPreloaded: true, easing: "easeOutBounce", onPlaySlider: function (e, t) { }, onComplete: function (e, t) { } }; $.extend(this.settings, t || {}); this.nextNo = null; this.previousNo = null; this.maxWidth = this.settings.mainWidth || 684; this.wrapper = $(e).find(this.settings.wapperSelector); var n = $('
').width(this.maxWidth); this.wrapper.wrap(n); this.slides = this.wrapper.find(this.settings.mainItemSelector); if (!this.wrapper.length || !this.slides.length) return; if (this.settings.maxItemDisplay > this.slides.length) { this.settings.maxItemDisplay = this.slides.length } this.currentNo = isNaN(this.settings.startItem) || this.settings.startItem > this.slides.length ? 0 : this.settings.startItem; this.navigatorOuter = $(e).find(this.settings.navOuterSelector); this.navigatorItems = $(e).find(this.settings.navItemsSelector); this.navigatorInner = this.navigatorOuter.find(this.settings.navInnerSelector); if (this.settings.navigatorHeight == null || this.settings.navigatorWidth == null) { this.settings.navigatorHeight = this.navigatorItems.eq(0).outerWidth(true); this.settings.navigatorWidth = this.navigatorItems.eq(0).outerHeight(true) } if (this.settings.navPosition == "horizontal") { this.navigatorInner.width(this.slides.length * this.settings.navigatorWidth); this.navigatorOuter.width(this.settings.maxItemDisplay * this.settings.navigatorWidth); this.navigatorOuter.height(this.settings.navigatorHeight) } else { this.navigatorInner.height(this.slides.length * this.settings.navigatorHeight); this.navigatorOuter.height(this.settings.maxItemDisplay * this.settings.navigatorHeight); this.navigatorOuter.width(this.settings.navigatorWidth) } this.slides.width(this.settings.mainWidth); this.navigratorStep = this.__getPositionMode(this.settings.navPosition); this.directionMode = this.__getDirectionMode(); if (this.settings.direction == "opacity") { this.wrapper.addClass("lof-opacity"); $(this.slides).css({ opacity: 0, "z-index": 1 }).eq(this.currentNo).css({ opacity: 1, "z-index": 3 }) } else { this.wrapper.css({ left: "-" + this.currentNo * this.maxSize + "px", width: this.maxWidth * this.slides.length }) } if (this.settings.isPreloaded) { this.preLoadImage(this.onComplete) } else { this.onComplete() } $buttonControl = $(".button-control", e); if (this.settings.auto) { $buttonControl.addClass("action-stop") } else { $buttonControl.addClass("action-start") } var r = this; $(e).hover(function () { r.stop(); $buttonControl.addClass("action-start").removeClass("action-stop").addClass("hover-stop") }, function () { if ($buttonControl.hasClass("hover-stop")) { if (r.settings.auto) { $buttonControl.removeClass("action-start").removeClass("hover-stop").addClass("action-stop"); r.play(r.settings.interval, "next", true) } } }); $buttonControl.click(function () { if ($buttonControl.hasClass("action-start")) { r.settings.auto = true; r.play(r.settings.interval, "next", true); $buttonControl.removeClass("action-start").addClass("action-stop") } else { r.settings.auto = false; r.stop(); $buttonControl.addClass("action-start").removeClass("action-stop") } }) }; $.lofSidernews.fn = $.lofSidernews.prototype; $.lofSidernews.fn.extend = $.lofSidernews.extend = $.extend; var manualClick = false; $.lofSidernews.fn.extend({ startUp: function (e, t) { seft = this; this.navigatorItems.each(function (e, t) { $(t).bind(seft.settings.navigatorEvent, function () { seft.jumping(e, false); seft.setNavActive(e, t); manualClick = true }); $(t).css({ height: seft.settings.navigatorHeight, width: seft.settings.navigatorWidth }) }); this.registerWheelHandler(this.navigatorOuter, this); this.setNavActive(this.currentNo); this.settings.onComplete(this.slides.eq(this.currentNo), this.currentNo); if (this.settings.buttons && typeof this.settings.buttons == "object") { this.registerButtonsControl("click", this.settings.buttons, this) } if (this.settings.auto) this.play(this.settings.interval, "next", true); return this }, onComplete: function () { setTimeout(function () { $(".preload").fadeOut(900, function () { $(".preload").remove() }) }, 400); this.startUp() }, preLoadImage: function (e) { var t = this; var n = this.wrapper.find("img"); var r = 0; n.each(function (e, i) { if (!i.complete) { i.onload = function () { r++; if (r >= n.length) { t.onComplete() } }; i.onerror = function () { r++; if (r >= n.length) { t.onComplete() } } } else { r++; if (r >= n.length) { t.onComplete() } } }) }, navivationAnimate: function (currentIndex) { if (currentIndex <= this.settings.startItem || currentIndex - this.settings.startItem >= this.settings.maxItemDisplay - 1) { this.settings.startItem = currentIndex - this.settings.maxItemDisplay + 2; if (this.settings.startItem < 0) this.settings.startItem = 0; if (this.settings.startItem > this.slides.length - this.settings.maxItemDisplay) { this.settings.startItem = this.slides.length - this.settings.maxItemDisplay } } var image = this.slides.eq(currentIndex).find("img"); if ($(image).attr("src") == "" || $(image).attr("src") == "images/loader-large.gif") { $(image).attr("src", $(image).attr("data-large-url")) } this.navigatorInner.stop().animate(eval("({" + this.navigratorStep[0] + ":-" + this.settings.startItem * this.navigratorStep[1] + "})"), { duration: 500, easing: "easeInOutQuad" }) }, setNavActive: function (e, t) { if (this.navigatorItems) { this.navigatorItems.removeClass("slider_active"); $(this.navigatorItems.get(e)).addClass("slider_active"); this.navivationAnimate(this.currentNo) } }, __getPositionMode: function (e) { if (e == "horizontal") { return ["left", this.settings.navigatorWidth] } return ["top", this.settings.navigatorHeight] }, __getDirectionMode: function () { switch (this.settings.direction) { case "opacity": this.maxSize = 0; return ["opacity", "opacity"]; default: this.maxSize = this.maxWidth; return ["left", "width"] } }, registerWheelHandler: function (e, t) { e.bind("mousewheel", function (e, n) { var r = n > 0 ? "Up" : "Down", i = Math.abs(n); if (n > 0) { t.previous(true) } else { t.next(true) } return false }) }, registerButtonsControl: function (e, t, n) { for (var r in t) { switch (r.toString()) { case "next": t[r].click(function () { n.next(true) }); break; case "previous": t[r].click(function () { n.previous(true) }); break } } return this }, onProcessing: function (e, t, n) { this.previousNo = this.currentNo + (this.currentNo > 0 ? -1 : this.slides.length - 1); this.nextNo = this.currentNo + (this.currentNo < this.slides.length - 1 ? 1 : 1 - this.slides.length); return this }, finishFx: function (e) { if (e) this.stop(); if (e && this.settings.auto) { this.play(this.settings.interval, "next", true) } this.setNavActive(this.currentNo); this.settings.onPlaySlider(this, $(this.slides).eq(this.currentNo)) }, getObjectDirection: function (start, end) { return eval("({'" + this.directionMode[0] + "':-" + this.currentNo * start + "})") }, fxStart: function (e, t, n) { var r = this; if (this.settings.direction == "opacity") { $(this.slides).stop().animate({ opacity: 0 }, { duration: this.settings.duration, easing: this.settings.easing, complete: function () { r.slides.css("z-index", "1"); r.slides.eq(e).css("z-index", "3") } }); $(this.slides).eq(e).stop().animate({ opacity: 1 }, { duration: this.settings.duration, easing: this.settings.easing, complete: function () { r.settings.onComplete($(r.slides).eq(e), e) } }) } else { this.wrapper.stop().animate(t, { duration: this.settings.duration, easing: this.settings.easing, complete: function () { r.settings.onComplete($(r.slides).eq(e), e) } }) } return this }, jumping: function (no, manual) { this.stop(); if (this.currentNo == no) return; var obj = eval("({'" + this.directionMode[0] + "':-" + this.maxSize * no + "})"); this.onProcessing(null, manual, 0, this.maxSize).fxStart(no, obj, this).finishFx(manual); this.currentNo = no }, next: function (e, t) { this.currentNo += this.currentNo < this.slides.length - 1 ? 1 : 1 - this.slides.length; this.onProcessing(t, e, 0, this.maxSize).fxStart(this.currentNo, this.getObjectDirection(this.maxSize), this).finishFx(e) }, previous: function (e, t) { this.currentNo += this.currentNo > 0 ? -1 : this.slides.length - 1; this.onProcessing(t, e).fxStart(this.currentNo, this.getObjectDirection(this.maxSize), this).finishFx(e) }, play: function (e, t, n) { this.stop(); if (!n) { this[t](false) } var r = this; this.isRun = setTimeout(function () { r[t](true) }, e) }, stop: function () { if (this.isRun == null) return; clearTimeout(this.isRun); this.isRun = null } }) })(jQuery) //--------------------------------------------------------------------------- jQuery.easing.jswing = jQuery.easing.swing; jQuery.extend(jQuery.easing, { def: "easeOutQuad", swing: function (x, t, b, c, d) { 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 * 0.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 * 0.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 * (0.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 -0.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) * 0.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 + 0.75) + b } else { if (t < (2.5 / 2.75)) { return c * (7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375) + b } else { return c * (7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375) + b } } } }, easeInOutBounce: function (x, t, b, c, d) { if (t < d / 2) { return jQuery.easing.easeInBounce(x, t * 2, 0, c, d) * 0.5 + b } return jQuery.easing.easeOutBounce(x, t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b } });