diff --git a/README b/README deleted file mode 100644 index 2e5185c..0000000 --- a/README +++ /dev/null @@ -1 +0,0 @@ -Nivo Slider is "The Most Awesome jQuery Image Slider". See http://nivo.dev7studios.com for more info. \ No newline at end of file diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..68982ff --- /dev/null +++ b/README.markdown @@ -0,0 +1,8 @@ +>Nivo Slider is "The Most Awesome jQuery Image Slider". See http://nivo.dev7studios.com for more info. + +## Branch Features +- New 'cycle', 'cycleLeft' and 'cycleRigt' effects, aka sliding. 'cycle' animates depending on slide direction. +- New 'slideIn' effect animates depending on slide direction. +- Supports Webkit keyboard arrow keys. +- Improved code which is less dependant on jQuery. +- Packed with Google Closure Compiler Advanced using jquery externs file. Smaller size than the original but with more features! \ No newline at end of file diff --git a/jquery-1.6.externs.js b/jquery-1.6.externs.js new file mode 100644 index 0000000..6b67de5 --- /dev/null +++ b/jquery-1.6.externs.js @@ -0,0 +1,1989 @@ +/* + * Copyright 2011 The Closure Compiler Authors. + * + * 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. + */ + +/** + * @fileoverview Externs for jQuery 1.6.1 + * + * Note that some functions use different return types depending on the number + * of parameters passed in. In these cases, you may need to annotate the type + * of the result in your code, so the JSCompiler understands which type you're + * expecting. For example: + * var elt = /** @type {Element} * / (foo.get(0)); + * + * @see http://api.jquery.com/ + * @externs + */ + +/** @typedef {(Window|Document|Element|Array.|string|jQuery| + * NodeList)} */ +var jQuerySelector; + +/** + * @constructor + * @param {(jQuerySelector|Element|Array.|Object|jQuery|string| + * function())=} arg1 + * @param {(Element|jQuery|Document| + * Object.)=} arg2 + * @return {jQuery} + */ +function jQuery(arg1, arg2) {}; + +/** + * @constructor + * @extends {jQuery} + * @param {(jQuerySelector|Element|Array.|Object|jQuery|string| + * function())} arg1 + * @param {(Element|jQuery|Document| + * Object.)=} arg2 + * @return {jQuery} + */ +function $(arg1, arg2) {}; + +/** + * @param {string} key + * @param {string} value + * @param {object} options + * @return {string} + */ +jQuery.cookie = function(key, value, options) {}; + +/** + * @param {(jQuerySelector|Array.|string)} arg1 + * @param {Element=} context + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.add = function(arg1, context) {}; + +/** + * @param {(string|function(number,String))} arg1 + * @return {jQuery} + */ +jQuery.prototype.addClass = function(arg1) {}; + +/** + * @param {(string|Element|jQuery|function(number))} arg1 + * @param {(string|Element|Array.|jQuery)=} content + * @return {jQuery} + */ +jQuery.prototype.after = function(arg1, content) {}; + +/** + * @param {(string|Object.)} arg1 + * @param {Object.=} settings + * @return {jQuery.jqXHR} + */ +jQuery.ajax = function(arg1, settings) {}; + +/** + * @param {(string|Object.)} arg1 + * @param {Object.=} settings + * @return {jQuery.jqXHR} + */ +$.ajax = function(arg1, settings) {}; + +/** + * @param {function(jQuery.event,XMLHttpRequest,Object.)} handler + * @return {jQuery} + */ +jQuery.prototype.ajaxComplete = function(handler) {}; + +/** + * @param {function(jQuery.event,jQuery.jqXHR,Object.,*)} handler + * @return {jQuery} + */ +jQuery.prototype.ajaxError = function(handler) {}; + +/** + * @param {(string| + * function(Object.,Object.,jQuery.jqXHR))} dataTypes + * @param {function(Object.,Object.,jQuery.jqXHR)=} handler + * @return {undefined} + */ +jQuery.ajaxPrefilter = function(dataTypes, handler) {}; + +/** + * @param {(string| + * function(Object.,Object.,jQuery.jqXHR))} dataTypes + * @param {function(Object.,Object.,jQuery.jqXHR)=} handler + * @return {undefined} + */ +$.ajaxPrefilter = function(dataTypes, handler) {}; + +/** + * @param {function(jQuery.event,jQuery.jqXHR,Object.)} handler + * @return {jQuery} + */ +jQuery.prototype.ajaxSend = function(handler) {}; + +/** @param {Object.} options */ +jQuery.ajaxSetup = function(options) {}; + +/** @param {Object.} options */ +$.ajaxSetup = function(options) {}; + +/** + * @param {function()} handler + * @return {jQuery} + */ +jQuery.prototype.ajaxStart = function(handler) {}; + +/** + * @param {function()} handler + * @return {jQuery} + */ +jQuery.prototype.ajaxStop = function(handler) {}; + +/** + * @param {function(jQuery.event,XMLHttpRequest,Object.)} handler + * @return {jQuery} + */ +jQuery.prototype.ajaxSuccess = function(handler) {}; + +/** + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.andSelf = function() {}; + +/** + * @param {Object.} properties + * @param {(string|number|function()|Object.)=} arg2 + * @param {(string|function())=} easing + * @param {function()=} complete + * @return {jQuery} + */ +jQuery.prototype.animate = function(properties, arg2, easing, complete) {}; + +/** + * @param {(string|Element|jQuery|function(number,string))} arg1 + * @param {(string|Element|Array.|jQuery)=} content + * @return {jQuery} + */ +jQuery.prototype.append = function(arg1, content) {}; + +/** + * @param {(jQuerySelector|Element|jQuery)} target + * @return {jQuery} + */ +jQuery.prototype.appendTo = function(target) {}; + +/** + * @param {(string|Object.)} arg1 + * @param {(string|number|function(number,string))=} arg2 + * @return {(string|jQuery)} + */ +jQuery.prototype.attr = function(arg1, arg2) {}; + +/** + * @param {(string|Element|jQuery|function())} arg1 + * @param {(string|Element|Array.|jQuery)=} content + * @return {jQuery} + */ +jQuery.prototype.before = function(arg1, content) {}; + +/** + * @param {(string|Object.)} arg1 + * @param {(Object.|function(jQuery.event)|boolean)=} eventData + * @param {(function(jQuery.event)|boolean)=} arg3 + * @return {jQuery} + */ +jQuery.prototype.bind = function(arg1, eventData, arg3) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.blur = function(arg1, handler) {}; + +/** @type {boolean} */ +jQuery.boxModel; + +/** @type {boolean} */ +$.boxModel; + +/** @type {jQuery.browser_} */ +jQuery.browser; + +/** @type {jQuery.browser_} */ +$.browser; + +/** + * This type is used interally to define the jQuery.browser subtype + * @constructor + * @private + */ +jQuery.browser_ = function() {}; + +/** + * @type {boolean} + * @const + */ +jQuery.browser_.prototype.mozilla; + +/** + * @type {boolean} + * @const + */ +jQuery.browser_.prototype.msie; + +/** + * @type {boolean} + * @const + */ +jQuery.browser_.prototype.opera; + +/** + * @type {boolean} + * @const + * @deprecated + */ +jQuery.browser_.prototype.safari; + +/** + * @type {string} + * @const + */ +jQuery.browser_.prototype.version; + +/** + * @type {boolean} + * @const + */ +jQuery.browser_.prototype.webkit; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.change = function(arg1, handler) {}; + +/** + * @param {jQuerySelector=} selector + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.children = function(selector) {}; + +/** + * @param {string=} queueName + * @return {jQuery} + */ +jQuery.prototype.clearQueue = function(queueName) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.click = function(arg1, handler) {}; + +/** + * @param {boolean=} withDataAndEvents + * @param {boolean=} deepWithDataAndEvents + * @return {jQuery} + * @suppress {checkTypes} http://code.google.com/p/closure-compiler/issues/detail?id=583 + */ +jQuery.prototype.clone = function(withDataAndEvents, deepWithDataAndEvents) {}; + +/** + * @param {(jQuerySelector|jQuery|Element|string|Array.)} arg1 + * @param {Element=} context + * @return {(jQuery|Array.)} + * @nosideeffects + */ +jQuery.prototype.closest = function(arg1, context) {}; + +/** + * @param {Element} container + * @param {Element} contained + * @return {boolean} + */ +jQuery.contains = function(container, contained) {}; + +/** + * @param {Element} container + * @param {Element} contained + * @return {boolean} + */ +$.contains = function(container, contained) {}; + +/** + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.contents = function() {}; + +/** @type {Element} */ +jQuery.prototype.context; + +/** + * @param {(string|Object.)} arg1 + * @param {(string|number|function(number,*))=} arg2 + * @return {(string|jQuery)} + */ +jQuery.prototype.css = function(arg1, arg2) {}; + +/** @type {Object.} */ +jQuery.cssHooks; + +/** @type {Object.} */ +$.cssHooks; + +/** + * @param {Element} elem + * @param {string=} key + * @param {*=} value + * @return {*} + */ +jQuery.data = function(elem, key, value) {}; + +/** + * @param {(string|Object.)=} arg1 + * @param {*=} value + * @return {*} + */ +jQuery.prototype.data = function(arg1, value) {}; + +/** + * @param {Element} elem + * @param {string=} key + * @param {*=} value + * @return {*} + */ +$.data = function(elem, key, value) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.dblclick = function(arg1, handler) {}; + +/** + * @constructor + * @param {function()=} opt_fn + * @see http://api.jquery.com/category/deferred-object/ + */ +jQuery.deferred = function(opt_fn) {}; + +/** + * @constructor + * @extends {jQuery.deferred} + * @param {function()=} opt_fn + * @return {jQuery.Deferred} + */ +jQuery.Deferred = function(opt_fn) {}; + +/** + * @constructor + * @extends {jQuery.deferred} + * @param {function()=} opt_fn + * @see http://api.jquery.com/category/deferred-object/ + */ +$.deferred = function(opt_fn) {}; + +/** + * @constructor + * @extends {jQuery.deferred} + * @param {function()=} opt_fn + * @return {jQuery.Deferred} + */ +$.Deferred = function(opt_fn) {}; + +/** + * @param {function()} alwaysCallbacks + * @return {jQuery.deferred} + */ +jQuery.deferred.prototype.always = function(alwaysCallbacks) {}; + +/** + * @param {function()} doneCallbacks + * @param {function()=} doneCallbacks2 + * @return {jQuery.deferred} + */ +jQuery.deferred.prototype.done = function(doneCallbacks, doneCallbacks2) {}; + +/** + * @param {function()} failCallbacks + * @param {function()=} failCallbacks2 + * @return {jQuery.deferred} + */ +jQuery.deferred.prototype.fail = function(failCallbacks, failCallbacks2) {}; + +/** + * @return {boolean} + * @nosideeffects + */ +jQuery.deferred.prototype.isRejected = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +jQuery.deferred.prototype.isResolved = function() {}; + +/** + * @param {function()=} doneFilter + * @param {function()=} failFilter + * @return {jQuery.Promise} + */ +jQuery.deferred.prototype.pipe = function(doneFilter, failFilter) {}; + +/** + * @param {Object=} target + * @return {jQuery.Promise} + */ +jQuery.deferred.prototype.promise = function(target) {}; + +/** + * @param {...*} var_args + * @return {jQuery.deferred} + */ +jQuery.deferred.prototype.reject = function(var_args) {}; + +/** + * @param {Object} context + * @param {Array.<*>=} args + * @return {jQuery.deferred} + */ +jQuery.deferred.prototype.rejectWith = function(context, args) {}; + +/** + * @param {...*} var_args + * @return {jQuery.deferred} + */ +jQuery.deferred.prototype.resolve = function(var_args) {}; + +/** + * @param {Object} context + * @param {Array.<*>=} args + * @return {jQuery.deferred} + */ +jQuery.deferred.prototype.resolveWith = function(context, args) {}; + +/** + * @param {function()} doneCallbacks + * @param {function()} failCallbacks + * @return {jQuery.deferred} + */ +jQuery.deferred.prototype.then = function(doneCallbacks, failCallbacks) {}; + +/** + * @param {number} duration + * @param {string=} queueName + * @return {jQuery} + */ +jQuery.prototype.delay = function(duration, queueName) {}; + +/** + * @param {string} selector + * @param {(string|Object.)} arg2 + * @param {(function()|Object.)=} arg3 + * @param {function()=} handler + * @return {jQuery} + */ +jQuery.prototype.delegate = function(selector, arg2, arg3, handler) {}; + +/** + * @param {Element} elem + * @param {string=} queueName + * @return {jQuery} + */ +jQuery.dequeue = function(elem, queueName) {}; + +/** + * @param {string=} queueName + * @return {jQuery} + */ +jQuery.prototype.dequeue = function(queueName) {}; + +/** + * @param {Element} elem + * @param {string=} queueName + * @return {jQuery} + */ +$.dequeue = function(elem, queueName) {}; + +/** + * @param {jQuerySelector=} selector + * @return {jQuery} + */ +jQuery.prototype.detach = function(selector) {}; + +/** + * @param {(string|Object.)=} arg1 + * @param {string=} handler + * @return {jQuery} + */ +jQuery.prototype.die = function(arg1, handler) {}; + +/** + * @param {Object} collection + * @param {function(number,*)} callback + * @return {Object} + */ +jQuery.each = function(collection, callback) {}; + +/** + * @param {function(number,Element)} fnc + * @return {jQuery} + */ +jQuery.prototype.each = function(fnc) {}; + +/** + * @param {Object} collection + * @param {function(number,*)} callback + * @return {Object} + */ +$.each = function(collection, callback) {}; + +/** @return {jQuery} */ +jQuery.prototype.empty = function() {}; + +/** + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.end = function() {}; + +/** + * @param {number} arg1 + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.eq = function(arg1) {}; + +/** @param {string} message */ +jQuery.error = function(message) {}; + +/** + * @param {(function(jQuery.event)|Object.)} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.error = function(arg1, handler) {}; + +/** @param {string} message */ +$.error = function(message) {}; + +/** + * @constructor + * @param {string} eventType + */ +jQuery.event = function(eventType) {}; + +/** + * @constructor + * @extends {jQuery.event} + * @param {string} eventType + * @return {jQuery.Event} + */ +jQuery.Event = function(eventType) {}; + +/** + * @constructor + * @extends {jQuery.event} + * @param {string} eventType + */ +$.event = function(eventType) {}; + +/** + * @constructor + * @extends {jQuery.event} + * @param {string} eventType + * @return {$.Event} + */ +$.Event = function(eventType) {}; + +/** @type {Element} */ +jQuery.event.prototype.currentTarget; + +/** @type {*} */ +jQuery.event.prototype.data; + +/** + * @return {boolean} + * @nosideeffects + */ +jQuery.event.prototype.isDefaultPrevented = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +jQuery.event.prototype.isImmediatePropagationStopped = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +jQuery.event.prototype.isPropagationStopped = function() {}; + +/** @type {string} */ +jQuery.event.prototype.namespace; + +/** @type {Event} */ +jQuery.event.prototype.originalEvent; + +/** @type {number} */ +jQuery.event.prototype.pageX; + +/** @type {number} */ +jQuery.event.prototype.pageY; + +/** @return {undefined} */ +jQuery.event.prototype.preventDefault = function() {}; + +/** @type {Object.} */ +jQuery.event.prototype.props; + +/** @type {Element} */ +jQuery.event.prototype.relatedTarget; + +/** @type {*} */ +jQuery.event.prototype.result; + +/** @return {undefined} */ +jQuery.event.prototype.stopImmediatePropagation = function() {}; + +/** @return {undefined} */ +jQuery.event.prototype.stopPropagation = function() {}; + +/** @type {Element} */ +jQuery.event.prototype.target; + +/** @type {number} */ +jQuery.event.prototype.timeStamp; + +/** @type {string} */ +jQuery.event.prototype.type; + +/** @type {number} */ +jQuery.event.prototype.which; + +/** + * @param {(Object|boolean)} arg1 + * @param {...*} var_args + * @return {Object} + */ +jQuery.extend = function(arg1, var_args) {}; + +/** + * @param {(Object|boolean)} arg1 + * @param {...*} var_args + * @return {Object} + */ +jQuery.prototype.extend = function(arg1, var_args) {}; + +/** + * @param {(Object|boolean)} arg1 + * @param {...*} var_args + * @return {Object} + */ +$.extend = function(arg1, var_args) {}; + +/** + * @param {(string|number|function())=} duration + * @param {(function()|string)=} arg2 + * @param {function()=} callback + * @return {jQuery} + */ +jQuery.prototype.fadeIn = function(duration, arg2, callback) {}; + +/** + * @param {(string|number|function())=} duration + * @param {(function()|string)=} arg2 + * @param {function()=} callback + * @return {jQuery} + */ +jQuery.prototype.fadeOut = function(duration, arg2, callback) {}; + +/** + * @param {(string|number)} duration + * @param {number} opacity + * @param {(function()|string)=} arg3 + * @param {function()=} callback + * @return {jQuery} + */ +jQuery.prototype.fadeTo = function(duration, opacity, arg3, callback) {}; + +/** + * @param {(string|number|function())=} duration + * @param {(string|function())=} easing + * @param {function()=} callback + * @return {jQuery} + */ +jQuery.prototype.fadeToggle = function(duration, easing, callback) {}; + +/** + * @param {(jQuerySelector|function(number)|Element|jQuery)} arg1 + * @return {jQuery} + */ +jQuery.prototype.filter = function(arg1) {}; + +/** + * @param {(jQuerySelector|jQuery|Element)} arg1 + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.find = function(arg1) {}; + +/** + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.first = function() {}; + +/** @see http://docs.jquery.com/Plugins/Authoring */ +jQuery.fn; + +/** @see http://docs.jquery.com/Plugins/Authoring */ +$.fn; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.focus = function(arg1, handler) {}; + +/** + * @param {(function(jQuery.event)|Object.)} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.focusin = function(arg1, handler) {}; + +/** + * @param {(function(jQuery.event)|Object.)} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.focusout = function(arg1, handler) {}; + +/** @const */ +jQuery.fx = {}; + +/** @const */ +$.fx = {}; + +/** @type {number} */ +jQuery.fx.interval; + +/** @type {number} */ +$.fx.interval; + +/** @type {boolean} */ +jQuery.fx.off; + +/** @type {boolean} */ +$.fx.off; + +/** + * @param {string} url + * @param {(Object.|string| + * function(string,string,jQuery.jqXHR))=} data + * @param {(function(string,string,jQuery.jqXHR)|string)=} success + * @param {string=} dataType + * @return {jQuery.jqXHR} + */ +jQuery.get = function(url, data, success, dataType) {}; + +/** + * @param {number=} index + * @return {(Element|Array.)} + * @nosideeffects + */ +jQuery.prototype.get = function(index) {}; + +/** + * @param {string} url + * @param {(Object.|string| + * function(string,string,jQuery.jqXHR))=} data + * @param {(function(string,string,jQuery.jqXHR)|string)=} success + * @param {string=} dataType + * @return {jQuery.jqXHR} + */ +$.get = function(url, data, success, dataType) {}; + +/** + * @param {string} url + * @param {(Object.|function(string,string,jQuery.jqXHR))=} data + * @param {function(string,string,jQuery.jqXHR)=} success + * @return {jQuery.jqXHR} + */ +jQuery.getJSON = function(url, data, success) {}; + +/** + * @param {string} url + * @param {(Object.|function(string,string,jQuery.jqXHR))=} data + * @param {function(string,string,jQuery.jqXHR)=} success + * @return {jQuery.jqXHR} + */ +$.getJSON = function(url, data, success) {}; + +/** + * @param {string} url + * @param {function(string,string)=} success + * @return {XMLHttpRequest} + */ +jQuery.getScript = function(url, success) {}; + +/** + * @param {string} url + * @param {function(string,string)=} success + * @return {XMLHttpRequest} + */ +$.getScript = function(url, success) {}; + +/** @param {string} code */ +jQuery.globalEval = function(code) {}; + +/** @param {string} code */ +$.globalEval = function(code) {}; + +/** + * @param {Array.<*>} arr + * @param {function(*,number)} fnc + * @param {boolean=} invert + * @return {Array.<*>} + */ +jQuery.grep = function(arr, fnc, invert) {}; + +/** + * @param {Array.<*>} arr + * @param {function(*,number)} fnc + * @param {boolean=} invert + * @return {Array.<*>} + */ +$.grep = function(arr, fnc, invert) {}; + +/** + * @param {(string|Element)} arg1 + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.has = function(arg1) {}; + +/** + * @param {string} className + * @return {boolean} + * @nosideeffects + */ +jQuery.prototype.hasClass = function(className) {}; + +/** + * @param {Element} elem + * @return {boolean} + * @nosideeffects + */ +jQuery.hasData = function(elem) {}; + +/** + * @param {Element} elem + * @return {boolean} + * @nosideeffects + */ +$.hasData = function(elem) {}; + +/** + * @param {(string|number|function(number,number))=} arg1 + * @return {(number|jQuery)} + */ +jQuery.prototype.height = function(arg1) {}; + +/** + * @param {(string|number|function())=} duration + * @param {(function()|string)=} arg2 + * @param {function()=} callback + * @return {jQuery} + */ +jQuery.prototype.hide = function(duration, arg2, callback) {}; + +/** + * @param {boolean} hold + * @return {boolean} + */ +jQuery.holdReady = function(hold) {}; + +/** + * @param {boolean} hold + * @return {boolean} + */ +$.holdReady = function(hold) {}; + +/** + * @param {function(jQuery.event)} arg1 + * @param {function(jQuery.event)=} handlerOut + * @return {jQuery} + */ +jQuery.prototype.hover = function(arg1, handlerOut) {}; + +/** + * @param {(string|function(number,string))=} arg1 + * @return {(string|jQuery)} + */ +jQuery.prototype.html = function(arg1) {}; + +/** + * @param {*} value + * @param {Array.<*>} arr + * @return {number} + * @nosideeffects + */ +jQuery.inArray = function(value, arr) {}; + +/** + * @param {*} value + * @param {Array.<*>} arr + * @return {number} + * @nosideeffects + */ +$.inArray = function(value, arr) {}; + +/** + * @param {(jQuerySelector|Element|jQuery)=} arg1 + * @return {number} + */ +jQuery.prototype.index = function(arg1) {}; + +/** + * @return {number} + * @nosideeffects + */ +jQuery.prototype.innerHeight = function() {}; + +/** + * @return {number} + * @nosideeffects + */ +jQuery.prototype.innerWidth = function() {}; + +/** + * @param {(jQuerySelector|Element|jQuery)} target + * @return {jQuery} + */ +jQuery.prototype.insertAfter = function(target) {}; + +/** + * @param {(jQuerySelector|Element|jQuery)} target + * @return {jQuery} + */ +jQuery.prototype.insertBefore = function(target) {}; + +/** + * @param {(jQuerySelector|function(number)|jQuery|Element)} arg1 + * @return {boolean} + */ +jQuery.prototype.is = function(arg1) {}; + +/** + * @param {*} obj + * @return {boolean} + * @nosideeffects + */ +jQuery.isArray = function(obj) {}; + +/** + * @param {*} obj + * @return {boolean} + * @nosideeffects + */ +$.isArray = function(obj) {}; + +/** + * @param {Object} obj + * @return {boolean} + * @nosideeffects + */ +jQuery.isEmptyObject = function(obj) {}; + +/** + * @param {Object} obj + * @return {boolean} + * @nosideeffects + */ +$.isEmptyObject = function(obj) {}; + +/** + * @param {*} obj + * @return {boolean} + * @nosideeffects + */ +jQuery.isFunction = function(obj) {}; + +/** + * @param {*} obj + * @return {boolean} + * @nosideeffects + */ +$.isFunction = function(obj) {}; + +/** + * @param {Object} obj + * @return {boolean} + * @nosideeffects + */ +jQuery.isPlainObject = function(obj) {}; + +/** + * @param {Object} obj + * @return {boolean} + * @nosideeffects + */ +$.isPlainObject = function(obj) {}; + +/** + * @param {*} obj + * @return {boolean} + * @nosideeffects + */ +jQuery.isWindow = function(obj) {}; + +/** + * @param {*} obj + * @return {boolean} + * @nosideeffects + */ +$.isWindow = function(obj) {}; + +/** + * @param {Element} node + * @return {boolean} + * @nosideeffects + */ +jQuery.isXMLDoc = function(node) {}; + +/** + * @param {Element} node + * @return {boolean} + * @nosideeffects + */ +$.isXMLDoc = function(node) {}; + +/** @type {string} */ +jQuery.prototype.jquery; + +/** + * @constructor + * @extends {XMLHttpRequest} + * @implements {jQuery.Promise} + * @private + * @see http://api.jquery.com/jQuery.ajax/#jqXHR + */ +jQuery.jqXHR = function () {}; + +/** + * @param {function()} callback + * @return {jQuery.jqXHR} +*/ +jQuery.jqXHR.prototype.complete = function (callback) {}; + +/** + * @override + * @param {function()} doneCallbacks + * @return {jQuery.Promise} + */ +jQuery.jqXHR.prototype.done = function(doneCallbacks) {}; + +/** + * @param {function()} callback + * @return {jQuery.jqXHR} +*/ +jQuery.jqXHR.prototype.error = function (callback) {}; + +/** + * @override + * @param {function()} failCallbacks + * @return {jQuery.Promise} + */ +jQuery.jqXHR.prototype.fail = function(failCallbacks) {}; + +/** + * @override + * @return {boolean} + * @nosideeffects + */ +jQuery.jqXHR.prototype.isRejected = function() {}; + +/** + * @override + * @return {boolean} + * @nosideeffects + */ +jQuery.jqXHR.prototype.isResolved = function() {}; + +/** + * @override + * @deprecated + */ +jQuery.jqXHR.prototype.onreadystatechange = function (callback) {}; + +/** + * @param {function()} callback + * @return {jQuery.jqXHR} +*/ +jQuery.jqXHR.prototype.success = function (callback) {}; + +/** + * @override + * @param {function()} doneCallbacks + * @param {function()} failCallbacks + * @return {jQuery.Promise} + */ +jQuery.jqXHR.prototype.then = function(doneCallbacks, failCallbacks) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.keydown = function(arg1, handler) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.keypress = function(arg1, handler) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.keyup = function(arg1, handler) {}; + +/** + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.last = function() {}; + +/** @type {number} */ +jQuery.prototype.length; + +/** + * @param {(string|Object.)} arg1 + * @param {(function()|Object.)=} arg2 + * @param {function()=} handler + * @return {jQuery} + */ +jQuery.prototype.live = function(arg1, arg2, handler) {}; + +/** + * @param {(function(jQuery.event)|Object.|string)} arg1 + * @param {(function(jQuery.event)|Object.|string)=} arg2 + * @param {function(string,string,XMLHttpRequest)=} complete + * @return {jQuery} + */ +jQuery.prototype.load = function(arg1, arg2, complete) {}; + +/** + * @param {*} obj + * @return {Array.<*>} + */ +jQuery.makeArray = function(obj) {}; + +/** + * @param {*} obj + * @return {Array.<*>} + */ +$.makeArray = function(obj) {}; + +/** + * @param {(Array.<*>|Object.)} arg1 + * @param {(function(*,number)|function(*,(string|number)))} callback + * @return {Array.<*>} + */ +jQuery.map = function(arg1, callback) {}; + +/** + * @param {function(number,Element)} callback + * @return {jQuery} + */ +jQuery.prototype.map = function(callback) {}; + +/** + * @param {(Array.<*>|Object.)} arg1 + * @param {(function(*,number)|function(*,(string|number)))} callback + * @return {Array.<*>} + */ +$.map = function(arg1, callback) {}; + +/** + * @param {Array.<*>} first + * @param {Array.<*>} second + * @return {Array.<*>} + */ +jQuery.merge = function(first, second) {}; + +/** + * @param {Array.<*>} first + * @param {Array.<*>} second + * @return {Array.<*>} + */ +$.merge = function(first, second) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.mousedown = function(arg1, handler) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.mouseenter = function(arg1, handler) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.mouseleave = function(arg1, handler) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.mousemove = function(arg1, handler) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.mouseout = function(arg1, handler) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.mouseover = function(arg1, handler) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.mouseup = function(arg1, handler) {}; + +/** + * @param {jQuerySelector=} selector + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.next = function(selector) {}; + +/** + * @param {string=} selector + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.nextAll = function(selector) {}; + +/** + * @param {jQuerySelector=} selector + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.nextUntil = function(selector) {}; + +/** + * @param {boolean=} removeAll + * @return {Object} + */ +jQuery.noConflict = function(removeAll) {}; + +/** + * @param {boolean=} removeAll + * @return {Object} + */ +$.noConflict = function(removeAll) {}; + +/** + * @return {function()} + * @nosideeffects + */ +jQuery.noop = function() {}; + +/** + * @return {function()} + * @nosideeffects + */ +$.noop = function() {}; + +/** + * @param {(jQuerySelector|Array.|function(number))} arg1 + * @return {jQuery} + */ +jQuery.prototype.not = function(arg1) {}; + +/** + * @return {number} + * @nosideeffects + */ +jQuery.now = function() {}; + +/** + * @return {number} + * @nosideeffects + */ +$.now = function() {}; + +/** + * @param {({left:number,top:number}| + * function(number,{top:number,left:number}))=} arg1 + * @return {({left:number,top:number}|jQuery)} + */ +jQuery.prototype.offset = function(arg1) {}; + +/** + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.offsetParent = function() {}; + +/** + * @param {string} eventType + * @param {(Object.|function(jQuery.event))} eventData + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.one = function(eventType, eventData, handler) {}; + +/** + * @param {boolean=} includeMargin + * @return {number} + * @nosideeffects + */ +jQuery.prototype.outerHeight = function(includeMargin) {}; + +/** + * @param {boolean=} includeMargin + * @return {number} + * @nosideeffects + */ +jQuery.prototype.outerWidth = function(includeMargin) {}; + +/** + * @param {(Object.|Array.>)} obj + * @param {boolean=} traditional + * @return {string} + */ +jQuery.param = function(obj, traditional) {}; + +/** + * @param {(Object.|Array.>)} obj + * @param {boolean=} traditional + * @return {string} + */ +$.param = function(obj, traditional) {}; + +/** + * @param {jQuerySelector=} selector + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.parent = function(selector) {}; + +/** + * @param {jQuerySelector=} selector + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.parents = function(selector) {}; + +/** + * @param {jQuerySelector=} selector + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.parentsUntil = function(selector) {}; + +/** + * @param {string} json + * @return {Object.} + */ +jQuery.parseJSON = function(json) {}; + +/** + * @param {string} json + * @return {Object.} + */ +$.parseJSON = function(json) {}; + +/** + * @param {string} data + * @return {Document} + */ +jQuery.parseXML = function(data) {}; + +/** + * @param {string} data + * @return {Document} + */ +$.parseXML = function(data) {}; + +/** + * @return {{left:number,top:number}} + * @nosideeffects + */ +jQuery.prototype.position = function() {}; + +/** + * @param {string} url + * @param {(Object.|string| + * function(string,string,jQuery.jqXHR))=} data + * @param {(function(string,string,jQuery.jqXHR)|string)=} success + * @param {string=} dataType + * @return {jQuery.jqXHR} + */ +jQuery.post = function(url, data, success, dataType) {}; + +/** + * @param {string} url + * @param {(Object.|string| + * function(string,string,jQuery.jqXHR))=} data + * @param {(function(string,string,jQuery.jqXHR)|string)=} success + * @param {string=} dataType + * @return {jQuery.jqXHR} + */ +$.post = function(url, data, success, dataType) {}; + +/** + * @param {(string|Element|jQuery|function(number,string))} arg1 + * @param {(string|Element|jQuery)=} content + * @return {jQuery} + */ +jQuery.prototype.prepend = function(arg1, content) {}; + +/** + * @param {(jQuerySelector|Element|jQuery)} target + * @return {jQuery} + */ +jQuery.prototype.prependTo = function(target) {}; + +/** + * @param {jQuerySelector=} selector + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.prev = function(selector) {}; + +/** + * @param {jQuerySelector=} selector + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.prevAll = function(selector) {}; + +/** + * @param {jQuerySelector=} selector + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.prevUntil = function(selector) {}; + +/** + * @param {(string|Object)=} type + * @param {Object=} target + * @return {jQuery.Promise} + */ +jQuery.prototype.promise = function(type, target) {}; + +/** + * @interface + * @private + * @see http://api.jquery.com/Types/#Promise + */ +jQuery.Promise = function () {}; + +/** + * @param {function()} doneCallbacks + * @return {jQuery.Promise} + */ +jQuery.Promise.prototype.done = function(doneCallbacks) {}; + +/** + * @param {function()} failCallbacks + * @return {jQuery.Promise} + */ +jQuery.Promise.prototype.fail = function(failCallbacks) {}; + +/** + * @return {boolean} + * @nosideeffects + */ +jQuery.Promise.prototype.isRejected = function() {}; + +/** + * @return {boolean} + * @nosideeffects + */ +jQuery.Promise.prototype.isResolved = function() {}; + +/** + * @param {function()} doneCallbacks + * @param {function()} failCallbacks + * @return {jQuery.Promise} + */ +jQuery.Promise.prototype.then = function(doneCallbacks, failCallbacks) {}; + +/** + * @param {(string|Object.)} arg1 + * @param {(string|number|boolean|function(number,String))=} arg2 + * @return {(string|jQuery)} + */ +jQuery.prototype.prop = function(arg1, arg2) {}; + +/** + * @param {(function()|Object)} arg1 + * @param {(Object|string)} arg2 + * @return {function()} + */ +jQuery.proxy = function(arg1, arg2) {}; + +/** + * @param {(function()|Object)} arg1 + * @param {(Object|string)} arg2 + * @return {function()} + */ +$.proxy = function(arg1, arg2) {}; + +/** + * @param {Array.} elements + * @param {string=} name + * @param {Array.<*>=} args + * @return {jQuery} + */ +jQuery.prototype.pushStack = function(elements, name, args) {}; + +/** + * @param {(string|Array.|function(function()))=} queueName + * @param {(Array.|function(function()))=} arg2 + * @return {(Array.|jQuery)} + */ +jQuery.prototype.queue = function(queueName, arg2) {}; + +/** + * @param {Element} elem + * @param {string=} queueName + * @param {(Array.|function())=} arg3 + * @return {(Array.|jQuery)} + */ +jQuery.queue = function(elem, queueName, arg3) {}; + +/** + * @param {Element} elem + * @param {string=} queueName + * @param {(Array.|function())=} arg3 + * @return {(Array.|jQuery)} + */ +$.queue = function(elem, queueName, arg3) {}; + +/** + * @param {function()} handler + * @return {jQuery} + */ +jQuery.prototype.ready = function(handler) {}; + +/** + * @param {string=} selector + * @return {jQuery} + */ +jQuery.prototype.remove = function(selector) {}; + +/** + * @param {string} attributeName + * @return {jQuery} + */ +jQuery.prototype.removeAttr = function(attributeName) {}; + +/** + * @param {(string|function(number,string))=} arg1 + * @return {jQuery} + */ +jQuery.prototype.removeClass = function(arg1) {}; + +/** + * @param {string=} name + * @return {jQuery} + */ +jQuery.prototype.removeData = function(name) {}; + +/** + * @param {Element} elem + * @param {string=} name + * @return {jQuery} + */ +jQuery.removeData = function(elem, name) {}; + +/** + * @param {Element} elem + * @param {string=} name + * @return {jQuery} + */ +$.removeData = function(elem, name) {}; + +/** + * @param {string} propertyName + * @param {(string|number|boolean)} value + * @return {jQuery} + */ +jQuery.prototype.removeProp = function(propertyName, value) {}; + +/** + * @param {jQuerySelector} target + * @return {jQuery} + */ +jQuery.prototype.replaceAll = function(target) {}; + +/** + * @param {(string|Element|jQuery|function())} arg1 + * @return {jQuery} + */ +jQuery.prototype.replaceWith = function(arg1) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.resize = function(arg1, handler) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.scroll = function(arg1, handler) {}; + +/** + * @param {number=} value + * @return {(number|jQuery)} + */ +jQuery.prototype.scrollLeft = function(value) {}; + +/** + * @param {number=} value + * @return {(number|jQuery)} + */ +jQuery.prototype.scrollTop = function(value) {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.select = function(arg1, handler) {}; + +/** + * @return {string} + * @nosideeffects + */ +jQuery.prototype.serialize = function() {}; + +/** + * @return {Array.>} + * @nosideeffects + */ +jQuery.prototype.serializeArray = function() {}; + +/** + * @param {(string|number|function())=} duration + * @param {(function()|string)=} arg2 + * @param {function()=} callback + * @return {jQuery} + */ +jQuery.prototype.show = function(duration, arg2, callback) {}; + +/** + * @param {jQuerySelector=} selector + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.siblings = function(selector) {}; + +/** + * @return {number} + * @nosideeffects + */ +jQuery.prototype.size = function() {}; + +/** + * @param {number} start + * @param {number=} end + * @return {jQuery} + * @nosideeffects + */ +jQuery.prototype.slice = function(start, end) {}; + +/** + * @param {(string|number|function())=} duration + * @param {(function()|string)=} arg2 + * @param {function()=} callback + * @return {jQuery} + */ +jQuery.prototype.slideDown = function(duration, arg2, callback) {}; + +/** + * @param {(string|number|function())=} duration + * @param {(function()|string)=} arg2 + * @param {function()=} callback + * @return {jQuery} + */ +jQuery.prototype.slideToggle = function(duration, arg2, callback) {}; + +/** + * @param {(string|number|function())=} duration + * @param {(function()|string)=} arg2 + * @param {function()=} callback + * @return {jQuery} + */ +jQuery.prototype.slideUp = function(duration, arg2, callback) {}; + +/** + * @param {boolean=} clearQueue + * @param {boolean=} jumpToEnd + * @return {jQuery} + */ +jQuery.prototype.stop = function(clearQueue, jumpToEnd) {}; + +/** + * @return {jQuery} + * @nosideeffects + */ +jQuery.sub = function() {}; + +/** + * @return {jQuery} + * @nosideeffects + */ +$.sub = function() {}; + +/** + * @param {(function(jQuery.event)|Object.)=} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.submit = function(arg1, handler) {}; + +/** @type {jQuery.support_} */ +jQuery.support; + +/** @type {jQuery.support_} */ +$.support; + +/** + * This type is used interally to define the jQuery.support subtype + * @constructor + * @private + */ +jQuery.support_ = function() {}; + +/** @type {boolean} */ +jQuery.support_.prototype.boxModel; + +/** @type {boolean} */ +jQuery.support_.prototype.changeBubbles; + +/** @type {boolean} */ +jQuery.support_.prototype.cssFloat; + +/** @type {boolean} */ +jQuery.support_.prototype.hrefNormalized; + +/** @type {boolean} */ +jQuery.support_.prototype.htmlSerialize; + +/** @type {boolean} */ +jQuery.support_.prototype.leadingWhitespace; + +/** @type {boolean} */ +jQuery.support_.prototype.noCloneEvent; + +/** @type {boolean} */ +jQuery.support_.prototype.opacity; + +/** @type {boolean} */ +jQuery.support_.prototype.scriptEval; + +/** @type {boolean} */ +jQuery.support_.prototype.style; + +/** @type {boolean} */ +jQuery.support_.prototype.submitBubbles; + +/** @type {boolean} */ +jQuery.support_.prototype.tbody; + +/** + * @param {(string|function(number,string))=} arg1 + * @return {(string|jQuery)} + */ +jQuery.prototype.text = function(arg1) {}; + +/** + * @return {Array.} + * @nosideeffects + */ +jQuery.prototype.toArray = function() {}; + +/** + * @param {(function(jQuery.event)|string|number|function()|boolean)=} arg1 + * @param {(function(jQuery.event)|function()|string)=} arg2 + * @param {(function(jQuery.event)|function())=} arg3 + * @return {jQuery} + */ +jQuery.prototype.toggle = function(arg1, arg2, arg3) {}; + +/** + * @param {(string|function(number,string))} arg1 + * @param {boolean=} flag + * @return {jQuery} + */ +jQuery.prototype.toggleClass = function(arg1, flag) {}; + +/** + * @param {(string|jQuery.event)} arg1 + * @param {Object=} extraParameters + * @return {jQuery} + */ +jQuery.prototype.trigger = function(arg1, extraParameters) {}; + +/** + * @param {string} eventType + * @param {Array.<*>} extraParameters + * @return {*} + */ +jQuery.prototype.triggerHandler = function(eventType, extraParameters) {}; + +/** + * @param {string} str + * @return {string} + * @nosideeffects + */ +jQuery.trim = function(str) {}; + +/** + * @param {string} str + * @return {string} + * @nosideeffects + */ +$.trim = function(str) {}; + +/** + * @param {*} obj + * @return {string} + * @nosideeffects + */ +jQuery.type = function(obj) {}; + +/** + * @param {*} obj + * @return {string} + * @nosideeffects + */ +$.type = function(obj) {}; + +/** + * @param {(string|function(jQuery.event)|jQuery.event)=} arg1 + * @param {(function(jQuery.event)|boolean)=} arg2 + * @return {jQuery} + */ +jQuery.prototype.unbind = function(arg1, arg2) {}; + +/** + * @param {string=} arg1 + * @param {(string|Object.)=} arg2 + * @param {function()=} handler + * @return {jQuery} + */ +jQuery.prototype.undelegate = function(arg1, arg2, handler) {}; + +/** + * @param {Array.} arr + * @return {Array.} + */ +jQuery.unique = function(arr) {}; + +/** + * @param {Array.} arr + * @return {Array.} + */ +$.unique = function(arr) {}; + +/** + * @param {(function(jQuery.event)|Object.)} arg1 + * @param {function(jQuery.event)=} handler + * @return {jQuery} + */ +jQuery.prototype.unload = function(arg1, handler) {}; + +/** @return {jQuery} */ +jQuery.prototype.unwrap = function() {}; + +/** + * @param {(string|function(number,*))=} arg1 + * @return {(string|number|Array.|jQuery)} + */ +jQuery.prototype.val = function(arg1) {}; + +/** + * @param {jQuery.deferred} deferreds + * @return {jQuery.Promise} + */ +jQuery.when = function(deferreds) {}; + +/** + * @param {jQuery.deferred} deferreds + * @return {jQuery.Promise} + */ +$.when = function(deferreds) {}; + +/** + * @param {(string|number|function(number,number))=} arg1 + * @return {(number|jQuery)} + */ +jQuery.prototype.width = function(arg1) {}; + +/** + * @param {(string|jQuerySelector|Element|jQuery|function(number))} arg1 + * @return {jQuery} + */ +jQuery.prototype.wrap = function(arg1) {}; + +/** + * @param {(string|jQuerySelector|Element|jQuery)} wrappingElement + * @return {jQuery} + */ +jQuery.prototype.wrapAll = function(wrappingElement) {}; + +/** + * @param {(string|function())} arg1 + * @return {jQuery} + */ +jQuery.prototype.wrapInner = function(arg1) {}; diff --git a/jquery.nivo.slider.js b/jquery.nivo.slider.js index d42f05c..c0b4340 100644 --- a/jquery.nivo.slider.js +++ b/jquery.nivo.slider.js @@ -1,694 +1,938 @@ -/* - * jQuery Nivo Slider v2.7.1 - * http://nivo.dev7studios.com - * - * Copyright 2011, Gilbert Pellegrom - * Free to use and abuse under the MIT license. - * http://www.opensource.org/licenses/mit-license.php - * - * March 2010 - */ - -(function($) { - - var NivoSlider = function(element, options){ - //Defaults are below +/** +* jQuery Nivo Slider v2.7.1 +* http://nivo.dev7studios.com +* +* Copyright 2011, Gilbert Pellegrom +* Free to use and abuse under the MIT license. +* http://www.opensource.org/licenses/mit-license.php +* +* January 2012 +*/ + +(function($){ + + var NivoSlider = function(element, options) + { + // Defaults are below var settings = $.extend({}, $.fn.nivoSlider.defaults, options); - //Useful variables. Play carefully. - var vars = { - currentSlide: 0, - currentImage: '', - totalSlides: 0, - running: false, - paused: false, - stop: false - }; - - //Get this slider - var slider = $(element); - slider.data('nivo:vars', vars); - slider.css('position','relative'); - slider.addClass('nivoSlider'); - - //Find our slider children - var kids = slider.children(); - kids.each(function() { - var child = $(this); - var link = ''; - if(!child.is('img')){ - if(child.is('a')){ - child.addClass('nivo-imageLink'); - link = child; - } - child = child.find('img:first'); - } - //Get img width & height - var childWidth = child.width(); - if(childWidth == 0) childWidth = child.attr('width'); - var childHeight = child.height(); - if(childHeight == 0) childHeight = child.attr('height'); - //Resize the slider - if(childWidth > slider.width()){ - slider.width(childWidth); - } - if(childHeight > slider.height()){ - slider.height(childHeight); - } - if(link != ''){ - link.css('display','none'); - } - child.css('display','none'); - vars.totalSlides++; - }); - - //If randomStart - if(settings.randomStart){ - settings.startSlide = Math.floor(Math.random() * vars.totalSlides); - } - - //Set startSlide - if(settings.startSlide > 0){ - if(settings.startSlide >= vars.totalSlides) settings.startSlide = vars.totalSlides - 1; - vars.currentSlide = settings.startSlide; - } - - //Get initial image - if($(kids[vars.currentSlide]).is('img')){ - vars.currentImage = $(kids[vars.currentSlide]); - } else { - vars.currentImage = $(kids[vars.currentSlide]).find('img:first'); - } - - //Show initial link - if($(kids[vars.currentSlide]).is('a')){ - $(kids[vars.currentSlide]).css('display','block'); - } - - //Set first background - slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat'); - - //Create caption - slider.append( - $('

').css({ display:'none', opacity:settings.captionOpacity }) - ); - - // Cross browser default caption opacity - $('.nivo-caption', slider).css('opacity', 0); - + /* + * All settings must be mapped here. This keeps them public when compiled. + * ( Remove this if you're not going to compile me! ) + */ + settings = { + effect: settings['effect'], + slices: settings['slices'], + boxCols: settings['boxCols'], + boxRows: settings['boxRows'], + animSpeed: settings['animSpeed'], + pauseTime: settings['pauseTime'], + startSlide: settings['startSlide'], + directionNav: settings['directionNav'], + directionNavHide: settings['directionNavHide'], + controlNav: settings['controlNav'], + controlNavThumbs: settings['controlNavThumbs'], + controlNavThumbsFromRel: settings['controlNavThumbsFromRel'], + controlNavThumbsSearch: settings['controlNavThumbsSearch'], + controlNavThumbsReplace: settings['controlNavThumbsReplace'], + keyboardNav: settings['keyboardNav'], + pauseOnHover: settings['pauseOnHover'], + manualAdvance: settings['manualAdvance'], + captionOpacity: settings['captionOpacity'], + prevText: settings['prevText'], + nextText: settings['nextText'], + randomStart: settings['randomStart'], + beforeChange: settings['beforeChange'], + afterChange: settings['afterChange'], + slideshowEnd: settings['slideshowEnd'], + lastSlide: settings['lastSlide'], + afterLoad: settings['afterLoad'] + }; + /* + * Mapping end. + */ + + // Useful variables. Play carefully. + var vars = { + previousSlideIndex: 0, + currentSlideIndex: 0, + currentImage: {}, + totalSlides: 0, + running: false, + paused: false, + stop: false + }; + + // element cache + var el = {}; + + // Get this slider + el.slider = $(element); + el.slider.data('nivo:vars', vars); + el.slider.css('position','relative'); + el.slider.addClass('nivoSlider'); + + // Find our slider children + el.slides = el.slider.children(); + el.linkSlides = el.slider.children('a') || false; + + var slide, + slidesIndex = el.slides.length, + slideWidth = 0, + slideHeight = 0; + + while(--slidesIndex + 1){ + slide = $(el.slides[slidesIndex]); + + if(!slide.is('img')){ + slide = slide.find('img').eq(0); + } + + // Get img width & height + slideWidth = slide.width(), + slideHeight = slide.height(); + + if(slideWidth === 0) slideWidth = slide.attr('width'); + if(slideHeight === 0) slideHeight = slide.attr('height'); + + // Resize the slider + if(slideWidth > el.slider.width()){ + el.slider.width(slideWidth); + } + if(slideHeight > el.slider.height()){ + el.slider.height(slideHeight); + } + + slide.css('display','none'); + + ++vars.totalSlides; + } + + // attach class to anchors + if(el.linkSlides){ + el.linkSlides.addClass('nivo-imageLink'); + } + + // If randomStart + if(settings.randomStart){ + settings.startSlide = Math.floor(Math.random() * vars.totalSlides); + } + + // Set startSlide + if(settings.startSlide > 0){ + // limit startslide at total slides count + if(settings.startSlide >= vars.totalSlides){ + settings.startSlide = vars.totalSlides - 1; + } + + vars.previousSlideIndex = settings.startSlide - 1; + vars.currentSlideIndex = settings.startSlide; + } + + // add current slide element to element object + el.currentSlide = $(el.slides[vars.currentSlideIndex]); + + // Get initial image + vars.currentImage = (el.currentSlide.is('img')) ? el.currentSlide : el.currentSlide.find('img').eq(0); + vars.currentImage = { + url: vars.currentImage.attr('src'), + title: vars.currentImage.attr('title') + }; + + // Show initial link + if(el.currentSlide.is('a')){ + el.currentSlide.css('display','block'); + } + + // Set first background + el.slider + .css('background', 'url("'+ vars.currentImage.url +'") no-repeat') + // Create caption + .append( + $('

').css({ display: 'none', opacity: settings.captionOpacity }) + ); + + // add caption elements to element object + el.sliderCaption = $('.nivo-caption', el.slider); + el.sliderCaptionP = el.sliderCaption.find('p'); + + // Cross browser default caption opacity + el.sliderCaption.css('opacity', 0); + // Process caption function - var processCaption = function(settings){ - var nivoCaption = $('.nivo-caption', slider); - if(vars.currentImage.attr('title') != '' && vars.currentImage.attr('title') != undefined){ - var title = vars.currentImage.attr('title'); - if(title.substr(0,1) == '#') title = $(title).html(); - - if(nivoCaption.css('opacity') != 0){ - nivoCaption.find('p').stop().fadeTo(settings.animSpeed, 0, function(){ - $(this).html(title); - $(this).stop().fadeTo(settings.animSpeed, 1); + var processCaption = function(){ + var title = vars.currentImage.title || null; + + if(title){ + if(title.substr(0,1) == '#'){ + title = $(title).html(); + } + + if(el.sliderCaption.css('opacity') != 0){ + el.sliderCaptionP.stop().fadeTo(settings.animSpeed, 0, function(){ + el.sliderCaptionP.html(title).stop().fadeTo(settings.animSpeed, 1); }); } else { - nivoCaption.find('p').html(title); - } - nivoCaption.stop().fadeTo(settings.animSpeed, settings.captionOpacity); - } else { - nivoCaption.stop().fadeTo(settings.animSpeed, 0); + el.sliderCaptionP.html(title); + } } + + el.sliderCaption.stop().fadeTo(settings.animSpeed, (title) ? settings.captionOpacity : 0); } - - //Process initial caption - processCaption(settings); - - //In the words of Super Mario "let's a go!" - var timer = 0; - if(!settings.manualAdvance && kids.length > 1){ - timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime); - } - - //Add Direction nav - if(settings.directionNav){ - slider.append(''); - - //Hide Direction nav - if(settings.directionNavHide){ - $('.nivo-directionNav', slider).hide(); - slider.hover(function(){ - $('.nivo-directionNav', slider).show(); - }, function(){ - $('.nivo-directionNav', slider).hide(); - }); - } - - $('a.nivo-prevNav', slider).live('click', function(){ - if(vars.running) return false; - clearInterval(timer); - timer = ''; - vars.currentSlide -= 2; - nivoRun(slider, kids, settings, 'prev'); - }); - - $('a.nivo-nextNav', slider).live('click', function(){ - if(vars.running) return false; - clearInterval(timer); - timer = ''; - nivoRun(slider, kids, settings, 'next'); - }); - } - - //Add Control nav - if(settings.controlNav){ - var nivoControl = $('
'); - slider.append(nivoControl); - for(var i = 0; i < kids.length; i++){ - if(settings.controlNavThumbs){ - var child = kids.eq(i); - if(!child.is('img')){ - child = child.find('img:first'); - } - if (settings.controlNavThumbsFromRel) { - nivoControl.append(''); - } else { - nivoControl.append(''); - } - } else { - nivoControl.append(''+ (i + 1) +''); - } - - } - //Set initial active link - $('.nivo-controlNav a:eq('+ vars.currentSlide +')', slider).addClass('active'); - - $('.nivo-controlNav a', slider).live('click', function(){ - if(vars.running) return false; - if($(this).hasClass('active')) return false; - clearInterval(timer); - timer = ''; - slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat'); - vars.currentSlide = $(this).attr('rel') - 1; - nivoRun(slider, kids, settings, 'control'); - }); - } - - //Keyboard Navigation - if(settings.keyboardNav){ - $(window).keypress(function(event){ - //Left - if(event.keyCode == '37'){ - if(vars.running) return false; - clearInterval(timer); - timer = ''; - vars.currentSlide-=2; - nivoRun(slider, kids, settings, 'prev'); - } - //Right - if(event.keyCode == '39'){ - if(vars.running) return false; - clearInterval(timer); - timer = ''; - nivoRun(slider, kids, settings, 'next'); - } - }); - } - - //For pauseOnHover setting - if(settings.pauseOnHover){ - slider.hover(function(){ - vars.paused = true; - clearInterval(timer); - timer = ''; - }, function(){ - vars.paused = false; - //Restart the timer - if(timer == '' && !settings.manualAdvance){ - timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime); - } - }); - } - - //Event when Animation finishes - slider.bind('nivo:animFinished', function(){ - vars.running = false; - //Hide child links - $(kids).each(function(){ - if($(this).is('a')){ - $(this).css('display','none'); - } - }); - //Show current link - if($(kids[vars.currentSlide]).is('a')){ - $(kids[vars.currentSlide]).css('display','block'); - } - //Restart the timer - if(timer == '' && !vars.paused && !settings.manualAdvance){ - timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime); - } - //Trigger the afterChange callback - settings.afterChange.call(this); - }); - - // Add slices for slice animations - var createSlices = function(slider, settings, vars){ - for(var i = 0; i < settings.slices; i++){ - var sliceWidth = Math.round(slider.width()/settings.slices); - if(i == settings.slices-1){ - slider.append( - $('
').css({ - left:(sliceWidth*i)+'px', width:(slider.width()-(sliceWidth*i))+'px', - height:'0px', - opacity:'0', - background: 'url("'+ vars.currentImage.attr('src') +'") no-repeat -'+ ((sliceWidth + (i * sliceWidth)) - sliceWidth) +'px 0%' - }) - ); + + // Process initial caption + processCaption(); + + // we need more than one slide! + if(vars.totalSlides < 2){ + return false; + } + + var timer = null; + + // In the words of Super Mario "let's a go!" + if(!settings.manualAdvance){ + timer = setInterval(function(){ nivoRun(false); }, settings.pauseTime); + } + + // Add Direction nav + if(settings.directionNav){ + + // insert direction controls + el.slider.append(''); + + // add direction nav element to element object + el.sliderDirectionNav = $('.nivo-directionNav', el.slider); + + // Hide Direction nav + if(settings.directionNavHide){ + el.sliderDirectionNav.hide(); + + el.slider.hover( + function(){ + el.sliderDirectionNav.show(); + }, + function(){ + el.sliderDirectionNav.hide(); + } + ); + } + + el.sliderDirectionNav + .children() + .click( + function(){ + var dir = $(this).data('dir') || 'next'; + + if(vars.running){ + return false; + } + + clearInterval(timer); + timer = null; + + if (dir === 'prev'){ + vars.currentSlideIndex -= 2; + } + nivoRun(dir); + } + ); + } + + // Add Control nav + if(settings.controlNav){ + var slide, + controlHTML = '', + controlHTMLContent = '', + i = el.slides.length; + + while(--i + 1){ + if(settings.controlNavThumbs){ + slide = $(el.slides[i]); + + if(!slide.is('img')){ + slide = slide.find('img').eq(0); + } + + if (settings.controlNavThumbsFromRel) { + controlHTMLContent = ''; + } else { + controlHTMLContent = ''; + } } else { - slider.append( - $('
').css({ - left:(sliceWidth*i)+'px', width:sliceWidth+'px', - height:'0px', - opacity:'0', - background: 'url("'+ vars.currentImage.attr('src') +'") no-repeat -'+ ((sliceWidth + (i * sliceWidth)) - sliceWidth) +'px 0%' - }) - ); + controlHTMLContent = i + 1; } + + controlHTML = ''+ controlHTMLContent +'' + controlHTML; } - } - + + // append control HTML as a whole + el.slider.append('
'+ controlHTML +'
'); + + // add control nav to elements object + el.sliderControlNav = $('.nivo-controlNav', el.slider); + el.sliderControlNavLinks = el.sliderControlNav.find('a'); + + // Set initial active link + el.sliderControlNavLinks + .click( + function(){ + var anchor = $(this); + + if(vars.running || anchor.hasClass('active')){ + return false; + } + + clearInterval(timer); + timer = null; + + el.slider.css('background', 'url("'+ vars.currentImage.url +'") no-repeat'); + + vars.currentSlideIndex = anchor.data('slide') - 1; + nivoRun('control'); + } + ) + .eq(vars.currentSlideIndex) + .addClass('active'); + } + + // Keyboard Navigation + if(settings.keyboardNav){ + $(document).keydown(function(e){ + var code = e.keyCode || e.which; + + if(vars.running){ + return false; + } + + clearInterval(timer); + timer = null; + + //Left + if(code === 37 || code === 63234){ + vars.currentSlideIndex -= 2; + nivoRun('prev'); + } + //Right + else if(code === 39 || code === 63235){ + nivoRun('next'); + } + }); + } + + // For pauseOnHover setting + if(settings.pauseOnHover){ + el.slider.hover( + function(){ + vars.paused = true; + + clearInterval(timer); + timer = null; + }, + function(){ + vars.paused = false; + + // Restart the timer + if(timer === null && !settings.manualAdvance){ + timer = setInterval(function(){ nivoRun(false); }, settings.pauseTime); + } + } + ); + } + + // Event when Animation finishes + el.slider.bind('nivo:animFinished', function(){ + vars.running = false; + + // Show current link + if(el.currentSlide.is('a')){ + el.currentSlide.css('display','block'); + } + + // Restart the timer + if(timer === null && !vars.paused && !settings.manualAdvance){ + timer = setInterval(function(){ nivoRun(false); }, settings.pauseTime); + } + + // Trigger the afterChange callback + settings.afterChange.call(this); + }); + + // Add slices for slice animations + var createSlices = function(slices){ + var sliderWidth = el.slider.width(), + i = 0, + sliceLimit = slices || settings.slices, + slicesHTML = document.createDocumentFragment(), + sliceWidth, + offset; + + var css = { + background: '', + left: '', + width: '', + height: '0', + opacity: 0 + }; + + do{ + sliceWidth = Math.round(sliderWidth / sliceLimit); + offset = sliceWidth * i; + + css.left = offset +'px'; + css.background = 'url("'+ vars.currentImage.url +'") no-repeat -'+ ((sliceWidth + offset) - sliceWidth) +'px 0%'; + css.width = sliceWidth +'px'; + + // fix up uneven spacing + if(i === sliceLimit - 1){ + css.width = (sliderWidth - offset) +'px'; + } + + // add slice to fragment - use jQuery to add css + slicesHTML.appendChild($('
').css(css)[0]); + } + while(++i < sliceLimit); + + // insert slices as a whole + el.slider.append(slicesHTML); + }; + // Add boxes for box animations - var createBoxes = function(slider, settings, vars){ - var boxWidth = Math.round(slider.width()/settings.boxCols); - var boxHeight = Math.round(slider.height()/settings.boxRows); - - for(var rows = 0; rows < settings.boxRows; rows++){ - for(var cols = 0; cols < settings.boxCols; cols++){ - if(cols == settings.boxCols-1){ - slider.append( - $('
').css({ - opacity:0, - left:(boxWidth*cols)+'px', - top:(boxHeight*rows)+'px', - width:(slider.width()-(boxWidth*cols))+'px', - height:boxHeight+'px', - background: 'url("'+ vars.currentImage.attr('src') +'") no-repeat -'+ ((boxWidth + (cols * boxWidth)) - boxWidth) +'px -'+ ((boxHeight + (rows * boxHeight)) - boxHeight) +'px' - }) - ); - } else { - slider.append( - $('
').css({ - opacity:0, - left:(boxWidth*cols)+'px', - top:(boxHeight*rows)+'px', - width:boxWidth+'px', - height:boxHeight+'px', - background: 'url("'+ vars.currentImage.attr('src') +'") no-repeat -'+ ((boxWidth + (cols * boxWidth)) - boxWidth) +'px -'+ ((boxHeight + (rows * boxHeight)) - boxHeight) +'px' - }) - ); + var createBoxes = function(){ + var sliderWidth = el.slider.width(), + boxWidth = Math.round(sliderWidth / settings.boxCols), + boxHeight = Math.round(el.slider.height() / settings.boxRows), + boxesHTML = document.createDocumentFragment(), + offsetLeft = 0, + row = 0, + col = 0; + + var css = { + background: 'url("'+ vars.currentImage.url +'") no-repeat', + backgroundPosition: '', + left: '', + top: '', + width: '', + height: boxHeight +'px', + opacity: 0 + }; + + do{ + // row specific styles + css.top = (boxHeight * row) +'px'; + css.width = boxWidth +'px'; + + do{ + offsetLeft = boxWidth * col; + + // column specific styles + css.left = offsetLeft +'px'; + css.backgroundPosition = '-'+ ((boxWidth + offsetLeft) - boxWidth) +'px -'+ ((boxHeight + (row * boxHeight)) - boxHeight) +'px'; + + // fix up uneven spacing + if(col === settings.boxCols - 1){ + css.width = (sliderWidth - offsetLeft) +'px'; } + + // add box to fragment - use jQuery to add css + boxesHTML.appendChild($('
').css(css)[0]); } + while(++col < settings.boxCols); + + // reset columns + col = 0; } - } + while(++row < settings.boxRows); + + // insert boxes as a whole + el.slider.append(boxesHTML); + }; - // Private run method - var nivoRun = function(slider, kids, settings, nudge){ + // Private run method + var nivoRun = function(nudge){ //Get our vars - var vars = slider.data('nivo:vars'); - - //Trigger the lastSlide callback - if(vars && (vars.currentSlide == vars.totalSlides - 1)){ + var vars = el.slider.data('nivo:vars'); + + // Trigger the lastSlide callback + if(vars && (vars.currentSlideIndex == vars.totalSlides - 1)){ settings.lastSlide.call(this); } - - // Stop - if((!vars || vars.stop) && !nudge) return false; - - //Trigger the beforeChange callback - settings.beforeChange.call(this); - - //Set current background before change - if(!nudge){ - slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat'); - } else { - if(nudge == 'prev'){ - slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat'); - } - if(nudge == 'next'){ - slider.css('background','url("'+ vars.currentImage.attr('src') +'") no-repeat'); - } + + // Stop + if((!vars || vars.stop) && !nudge){ + return false; } - vars.currentSlide++; - //Trigger the slideshowEnd callback - if(vars.currentSlide == vars.totalSlides){ - vars.currentSlide = 0; + + // Trigger the beforeChange callback + settings.beforeChange.call(this); + + // Set current background before change + el.slider.css('background','url("'+ vars.currentImage.url +'") no-repeat'); + + // previous index is stored at the end of this function + + // increment current index + ++vars.currentSlideIndex; + + if(vars.currentSlideIndex >= vars.totalSlides){ + vars.currentSlideIndex = 0; + + //Trigger the slideshowEnd callback settings.slideshowEnd.call(this); } - if(vars.currentSlide < 0) vars.currentSlide = (vars.totalSlides - 1); - //Set vars.currentImage - if($(kids[vars.currentSlide]).is('img')){ - vars.currentImage = $(kids[vars.currentSlide]); - } else { - vars.currentImage = $(kids[vars.currentSlide]).find('img:first'); + else if(vars.currentSlideIndex < 0){ + vars.currentSlideIndex = vars.totalSlides - 1; } - - //Set active links + + // update previous slide element + el.previousSlide = el.currentSlide; + + // update current slide element + el.currentSlide = $(el.slides[vars.currentSlideIndex]); + + //Set slide images + vars.previousImage = vars.currentImage; + + vars.currentImage = (el.currentSlide.is('img')) ? el.currentSlide : el.currentSlide.find('img').eq(0); + vars.currentImage = { + url: vars.currentImage.attr('src'), + title: vars.currentImage.attr('title'), + transition: vars.currentImage.data('transition') + }; + + // Set active links if(settings.controlNav){ - $('.nivo-controlNav a', slider).removeClass('active'); - $('.nivo-controlNav a:eq('+ vars.currentSlide +')', slider).addClass('active'); + el.sliderControlNavLinks.removeClass('active').eq(vars.currentSlideIndex).addClass('active'); } - - //Process caption - processCaption(settings); - + + // hide links + if(el.linkSlides){ + el.linkSlides.css('display','none'); + } + + // Process caption + processCaption(); + // Remove any slices from last transition - $('.nivo-slice', slider).remove(); - + $('.nivo-slice', el.slider).remove(); // Remove any boxes from last transition - $('.nivo-box', slider).remove(); - - var currentEffect = settings.effect; - //Generate random effect - if(settings.effect == 'random'){ - var anims = new Array('sliceDownRight','sliceDownLeft','sliceUpRight','sliceUpLeft','sliceUpDown','sliceUpDownLeft','fold','fade', - 'boxRandom','boxRain','boxRainReverse','boxRainGrow','boxRainGrowReverse'); - currentEffect = anims[Math.floor(Math.random()*(anims.length + 1))]; - if(currentEffect == undefined) currentEffect = 'fade'; + $('.nivo-box', el.slider).remove(); + + var currentEffect = settings.effect || 'fade'; + + // Generate random effect + if(settings.effect === 'random'){ + var anims = ['sliceDownRight','sliceDownLeft','sliceUpRight','sliceUpLeft','sliceUpDown','sliceUpDownLeft','fold','fade', + 'cycle','boxRandom','boxRain','boxRainReverse','boxRainGrow','boxRainGrowReverse']; + + currentEffect = anims[Math.floor(Math.random() * (anims.length - 1))]; + } + // Run random effect from specified set (eg: effect:'fold,fade') + else if(settings.effect.indexOf(',') !== -1){ + var anims = settings.effect.split(','); + + currentEffect = anims[Math.floor(Math.random() * anims.length)]; + } + + // Custom transition as defined by "data-transition" attribute + if(vars.currentImage.transition){ + currentEffect = vars.currentImage.transition; } - - //Run random effect from specified set (eg: effect:'fold,fade') - if(settings.effect.indexOf(',') != -1){ - var anims = settings.effect.split(','); - currentEffect = anims[Math.floor(Math.random()*(anims.length))]; - if(currentEffect == undefined) currentEffect = 'fade'; - } - - //Custom transition as defined by "data-transition" attribute - if(vars.currentImage.attr('data-transition')){ - currentEffect = vars.currentImage.attr('data-transition'); - } - - //Run effects + + // Run effects vars.running = true; - if(currentEffect == 'sliceDown' || currentEffect == 'sliceDownRight' || currentEffect == 'sliceDownLeft'){ - createSlices(slider, settings, vars); - var timeBuff = 0; - var i = 0; - var slices = $('.nivo-slice', slider); - if(currentEffect == 'sliceDownLeft') slices = $('.nivo-slice', slider)._reverse(); - - slices.each(function(){ - var slice = $(this); - slice.css({ 'top': '0px' }); - if(i == settings.slices-1){ - setTimeout(function(){ - slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); }); - }, (100 + timeBuff)); - } else { - setTimeout(function(){ - slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed); - }, (100 + timeBuff)); + + var timedAnimate = function(element, css, speed, buff, end){ + setTimeout(function(){ + element.animate(css, (speed || settings.animSpeed), '', (end && function(){ el.slider.trigger('nivo:animFinished'); })); + }, 100 + buff) + } + + switch(currentEffect){ + case 'sliceDown': + case 'sliceDownRight': + case 'sliceDownLeft': + createSlices(); + + var timeBuff = 0, + slices = $('.nivo-slice', el.slider), + sliceIndex = 0, + slice; + + if(currentEffect === 'sliceDownLeft'){ + slices = slices._reverse(); } - timeBuff += 50; - i++; - }); - } - else if(currentEffect == 'sliceUp' || currentEffect == 'sliceUpRight' || currentEffect == 'sliceUpLeft'){ - createSlices(slider, settings, vars); - var timeBuff = 0; - var i = 0; - var slices = $('.nivo-slice', slider); - if(currentEffect == 'sliceUpLeft') slices = $('.nivo-slice', slider)._reverse(); - - slices.each(function(){ - var slice = $(this); - slice.css({ 'bottom': '0px' }); - if(i == settings.slices-1){ - setTimeout(function(){ - slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); }); - }, (100 + timeBuff)); - } else { - setTimeout(function(){ - slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed); - }, (100 + timeBuff)); + + do{ + slice = $(slices[sliceIndex]); + + slice.css({ 'top': '0' }); + + timedAnimate(slice, { height: '100%', opacity: 1 }, null, timeBuff, (sliceIndex === settings.slices - 1) ? true : false); + + timeBuff += 50; } - timeBuff += 50; - i++; - }); - } - else if(currentEffect == 'sliceUpDown' || currentEffect == 'sliceUpDownRight' || currentEffect == 'sliceUpDownLeft'){ - createSlices(slider, settings, vars); - var timeBuff = 0; - var i = 0; - var v = 0; - var slices = $('.nivo-slice', slider); - if(currentEffect == 'sliceUpDownLeft') slices = $('.nivo-slice', slider)._reverse(); - - slices.each(function(){ - var slice = $(this); - if(i == 0){ - slice.css('top','0px'); - i++; - } else { - slice.css('bottom','0px'); - i = 0; + while(++sliceIndex < settings.slices); + break; + + case 'sliceUp': + case 'sliceUpRight': + case 'sliceUpLeft': + createSlices(); + + var timeBuff = 0, + slices = $('.nivo-slice', el.slider), + sliceIndex = 0, + slice; + + if(currentEffect === 'sliceUpLeft'){ + slices = slices._reverse(); } - - if(v == settings.slices-1){ - setTimeout(function(){ - slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); }); - }, (100 + timeBuff)); - } else { - setTimeout(function(){ - slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed); - }, (100 + timeBuff)); + + do{ + slice = $(slices[sliceIndex]); + + slice.css({ 'bottom': '0' }); + + timedAnimate(slice, { height: '100%', opacity: 1 }, null, timeBuff, (sliceIndex === settings.slices - 1) ? true : false); + + timeBuff += 50; } - timeBuff += 50; - v++; - }); - } - else if(currentEffect == 'fold'){ - createSlices(slider, settings, vars); - var timeBuff = 0; - var i = 0; - - $('.nivo-slice', slider).each(function(){ - var slice = $(this); - var origWidth = slice.width(); - slice.css({ top:'0px', height:'100%', width:'0px' }); - if(i == settings.slices-1){ - setTimeout(function(){ - slice.animate({ width:origWidth, opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); }); - }, (100 + timeBuff)); - } else { - setTimeout(function(){ - slice.animate({ width:origWidth, opacity:'1.0' }, settings.animSpeed); - }, (100 + timeBuff)); + while(++sliceIndex < settings.slices); + break; + + case 'sliceUpDown': + case 'sliceUpDownRight': + case 'sliceUpDownLeft': + createSlices(); + + var timeBuff = 0, + top = 0, + slices = $('.nivo-slice', el.slider), + sliceIndex = 0, + slice; + + if(currentEffect === 'sliceUpDownLeft'){ + slices = slices._reverse(); } - timeBuff += 50; - i++; - }); - } - else if(currentEffect == 'fade'){ - createSlices(slider, settings, vars); - - var firstSlice = $('.nivo-slice:first', slider); - firstSlice.css({ - 'height': '100%', - 'width': slider.width() + 'px' - }); - - firstSlice.animate({ opacity:'1.0' }, (settings.animSpeed*2), '', function(){ slider.trigger('nivo:animFinished'); }); - } - else if(currentEffect == 'slideInRight'){ - createSlices(slider, settings, vars); - - var firstSlice = $('.nivo-slice:first', slider); - firstSlice.css({ - 'height': '100%', - 'width': '0px', - 'opacity': '1' - }); - - firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed*2), '', function(){ slider.trigger('nivo:animFinished'); }); - } - else if(currentEffect == 'slideInLeft'){ - createSlices(slider, settings, vars); - - var firstSlice = $('.nivo-slice:first', slider); - firstSlice.css({ - 'height': '100%', - 'width': '0px', - 'opacity': '1', - 'left': '', - 'right': '0px' - }); - - firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed*2), '', function(){ - // Reset positioning - firstSlice.css({ - 'left': '0px', - 'right': '' - }); - slider.trigger('nivo:animFinished'); - }); - } - else if(currentEffect == 'boxRandom'){ - createBoxes(slider, settings, vars); - - var totalBoxes = settings.boxCols * settings.boxRows; - var i = 0; - var timeBuff = 0; - - var boxes = shuffle($('.nivo-box', slider)); - boxes.each(function(){ - var box = $(this); - if(i == totalBoxes-1){ - setTimeout(function(){ - box.animate({ opacity:'1' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); }); - }, (100 + timeBuff)); - } else { - setTimeout(function(){ - box.animate({ opacity:'1' }, settings.animSpeed); - }, (100 + timeBuff)); + + do{ + slice = $(slices[sliceIndex]); + + if(top){ + slice.css('top', '0'); + } else { + slice.css('bottom', '0'); + } + // flip bool + top = !top; + + timedAnimate(slice, { height: '100%', opacity: 1 }, null, timeBuff, (sliceIndex === settings.slices - 1) ? true : false); + + timeBuff += 50; } - timeBuff += 20; - i++; - }); - } - else if(currentEffect == 'boxRain' || currentEffect == 'boxRainReverse' || currentEffect == 'boxRainGrow' || currentEffect == 'boxRainGrowReverse'){ - createBoxes(slider, settings, vars); - - var totalBoxes = settings.boxCols * settings.boxRows; - var i = 0; - var timeBuff = 0; - - // Split boxes into 2D array - var rowIndex = 0; - var colIndex = 0; - var box2Darr = new Array(); - box2Darr[rowIndex] = new Array(); - var boxes = $('.nivo-box', slider); - if(currentEffect == 'boxRainReverse' || currentEffect == 'boxRainGrowReverse'){ - boxes = $('.nivo-box', slider)._reverse(); - } - boxes.each(function(){ - box2Darr[rowIndex][colIndex] = $(this); - colIndex++; - if(colIndex == settings.boxCols){ - rowIndex++; - colIndex = 0; - box2Darr[rowIndex] = new Array(); + while(++sliceIndex < settings.slices); + break; + + case 'fold': + createSlices(); + + var timeBuff = 0, + slices = $('.nivo-slice', el.slider), + sliceIndex = 0, + slice, + sliceWidth = 0; + + do{ + slice = $(slices[sliceIndex]); + sliceWidth = slice.width(); + + slice.css({ top: '0', height: '100%', width: '0' }); + + timedAnimate(slice, { width: sliceWidth +'px', opacity: 1 }, null, timeBuff, (sliceIndex === settings.slices - 1) ? true : false); + + timeBuff += 50; } - }); - - // Run animation - for(var cols = 0; cols < (settings.boxCols * 2); cols++){ - var prevCol = cols; - for(var rows = 0; rows < settings.boxRows; rows++){ - if(prevCol >= 0 && prevCol < settings.boxCols){ - /* Due to some weird JS bug with loop vars - being used in setTimeout, this is wrapped - with an anonymous function call */ - (function(row, col, time, i, totalBoxes) { - var box = $(box2Darr[row][col]); - var w = box.width(); - var h = box.height(); - if(currentEffect == 'boxRainGrow' || currentEffect == 'boxRainGrowReverse'){ - box.width(0).height(0); - } - if(i == totalBoxes-1){ - setTimeout(function(){ - box.animate({ opacity:'1', width:w, height:h }, settings.animSpeed/1.3, '', function(){ slider.trigger('nivo:animFinished'); }); - }, (100 + time)); - } else { - setTimeout(function(){ - box.animate({ opacity:'1', width:w, height:h }, settings.animSpeed/1.3); - }, (100 + time)); + while(++sliceIndex < settings.slices); + break; + + default: + case 'fade': + createSlices(1); + + var slice = $('.nivo-slice', el.slider); + + slice + .css({ width: el.slider.width() +'px', height: '100%' }) + + .animate({ opacity: 1 }, (settings.animSpeed * 2), '', function(){ + el.slider.trigger('nivo:animFinished'); + }); + break; + + case 'cycle': + case 'cycleLeft': + case 'cycleRight': + createSlices(1); + + var sliderWidth = el.slider.width(), + slice = $('.nivo-slice', el.slider), + cycleLeft = (currentEffect === 'cycleLeft' || (currentEffect === 'cycle' && (nudge === 'prev' || (nudge === 'control' && vars.currentSlideIndex < vars.previousSlideIndex)))) ? true : false, + css1, css2, + sliceHTML = document.createDocumentFragment(); + + css1 = { + position: 'absolute', + right: (cycleLeft) ? '0' : sliderWidth +'px', + background: 'url("'+ vars.previousImage.url +'")', + width: sliderWidth +'px', + height: '100%' + }; + + css2 = { + position: 'absolute', + right: (cycleLeft) ? sliderWidth +'px' : '0', + background: 'url("'+ vars.currentImage.url +'")', + width: sliderWidth +'px', + height: '100%' + }; + + sliceHTML.appendChild($('
').css(css1)[0]); + sliceHTML.appendChild($('
').css(css2)[0]); + slice.html(sliceHTML); + + var css = { + left: (cycleLeft) ? -sliderWidth +'px' : '0', + width: (sliderWidth * 2) +'px', + height: '100%', + opacity: 1 + }; + + slice + .css(css) + + .animate({ left: ((cycleLeft) ? '0' : -sliderWidth +'px') }, (settings.animSpeed * 2), '', function(){ + el.slider.trigger('nivo:animFinished'); + }); + break; + + case 'slideInHorizontal': + case 'slideInLeft': + case 'slideInRight': + createSlices(1); + + var slice = $('.nivo-slice', el.slider), + slideInLeft = (currentEffect === 'slideInLeft' || (currentEffect === 'slideInHorizontal' && (nudge === 'prev' || (nudge === 'control' && vars.currentSlideIndex < vars.previousSlideIndex)))) ? true : false; + + var css = { + left: (slideInLeft) ? '0' : '', + right: (slideInLeft) ? '' : '0', + backgroundPosition: (slideInLeft) ? '100% 0' : '0 0', + width: '0', + height: '100%', + opacity: 1 + }; + + slice + .css(css) + + .animate({ width: '100%' }, (settings.animSpeed * 2), '', function(){ + el.slider.trigger('nivo:animFinished'); + }); + break; + + case 'slideInVertical': + case 'slideInTop': + case 'slideInBottom': + createSlices(1); + + var slice = $('.nivo-slice', el.slider), + slideInTop = (currentEffect === 'slideInTop' || (currentEffect === 'slideInVertical' && (nudge === 'prev' || (nudge === 'control' && vars.currentSlideIndex > vars.previousSlideIndex)))) ? true : false; + + var css = { + top: (slideInTop) ? '0' : '', + bottom: (slideInTop) ? '' : '0', + backgroundPosition: (slideInTop) ? '0 100%' : '0 0', + width: '100%', + height: '0', + opacity: 1 + }; + + slice + .css(css) + + .animate({ height: '100%' }, (settings.animSpeed * 2), '', function(){ + el.slider.trigger('nivo:animFinished'); + }); + break; + + case 'boxRandom': + createBoxes(); + + var totalBoxes = settings.boxCols * settings.boxRows, + timeBuff = 0, + boxes = shuffle($('.nivo-box', el.slider)), + boxIndex = 0, + box; + + do{ + box = $(boxes[boxIndex]); + + timedAnimate(box, { opacity: 1 }, null, timeBuff, (boxIndex === totalBoxes - 1) ? true : false); + + timeBuff += 20; + } + while(++boxIndex < totalBoxes); + break; + + case 'boxRain': + case 'boxRainReverse': + case 'boxRainGrow': + case 'boxRainGrowReverse': + createBoxes(); + + var totalBoxes = settings.boxCols * settings.boxRows, + timeBuff = 0, + box2Darr = new Array(), + rowIndex = 0, + colIndex = 0, + boxes = $('.nivo-box', el.slider), + boxIndex = 0, + i = totalBoxes; + + if(currentEffect == 'boxRainReverse' || currentEffect == 'boxRainGrowReverse'){ + boxes = boxes._reverse(); + } + + // Split boxes into 2D array + box2Darr[rowIndex] = new Array(); + + do{ + box2Darr[rowIndex][colIndex] = boxes[boxIndex]; + ++colIndex; + ++boxIndex; + + if(colIndex === settings.boxCols){ + ++rowIndex; + box2Darr[rowIndex] = new Array(); + + // reset column + colIndex = 0; + } + } + while(--i); + + var cols = 0, + rows = 0, + curCol = 0, + i = 0, + box, + boxWidth = 0, + boxHeight = 0; + + // Run animation + do{ + curCol = cols; + + do{ + if(curCol >= 0 && curCol < settings.boxCols){ + box = $(box2Darr[rows][curCol]); + boxWidth = box.width(); + boxHeight = box.height(); + + if(currentEffect == 'boxRainGrow' || currentEffect == 'boxRainGrowReverse'){ + box.width(0).height(0); } - })(rows, prevCol, timeBuff, i, totalBoxes); - i++; + + timedAnimate(box, { width: boxWidth, height: boxHeight, opacity: 1}, settings.animSpeed / 1.3, timeBuff, (++i === totalBoxes) ? true : false); + } + + --curCol; } - prevCol--; + while(++rows < settings.boxRows); + + // reset rows + rows = 0; + + timeBuff += 100; } - timeBuff += 100; - } + while(++cols < (settings.boxCols * 2)); + break; } + + // save current index as previous index + vars.previousSlideIndex = vars.currentSlideIndex; } - + // Shuffle an array var shuffle = function(arr){ - for(var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x); + for(var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x){}; return arr; } - - // For debugging - var trace = function(msg){ - if (this.console && typeof console.log != "undefined") - console.log(msg); - } - - // Start / Stop - this.stop = function(){ - if(!$(element).data('nivo:vars').stop){ - $(element).data('nivo:vars').stop = true; - trace('Stop Slider'); - } - } - - this.start = function(){ - if($(element).data('nivo:vars').stop){ - $(element).data('nivo:vars').stop = false; - trace('Start Slider'); - } - } - - //Trigger the afterLoad callback - settings.afterLoad.call(this); - + + // Start / Stop + this.stop = function(){ + if(!el.slider.data('nivo:vars').stop){ + el.slider.data('nivo:vars').stop = true; + } + }; + + this.start = function(){ + if(el.slider.data('nivo:vars').stop){ + el.slider.data('nivo:vars').stop = false; + } + }; + + // Trigger the afterLoad callback + settings.afterLoad.call(this); + return this; - }; - - $.fn.nivoSlider = function(options) { - - return this.each(function(key, value){ - var element = $(this); - // Return early if this element already has a plugin instance - if (element.data('nivoslider')) return element.data('nivoslider'); - // Pass options to plugin constructor - var nivoslider = new NivoSlider(this, options); - // Store plugin object in this element's data - element.data('nivoslider', nivoslider); - }); + }; + $.fn.nivoSlider = function(options){ + return this.each(function(key, value){ + var element = $(this); + // Return early if this element already has a plugin instance + if (element.data('nivoslider')){ + return element.data('nivoslider'); + } + // Pass options to plugin constructor + var nivoslider = new NivoSlider(this, options); + // Store plugin object in this element's data + element.data('nivoslider', nivoslider); + }); }; - - //Default settings + + // Default settings $.fn.nivoSlider.defaults = { - effect: 'random', - slices: 15, - boxCols: 8, - boxRows: 4, - animSpeed: 500, - pauseTime: 3000, - startSlide: 0, - directionNav: true, - directionNavHide: true, - controlNav: true, - controlNavThumbs: false, - controlNavThumbsFromRel: false, - controlNavThumbsSearch: '.jpg', - controlNavThumbsReplace: '_thumb.jpg', - keyboardNav: true, - pauseOnHover: true, - manualAdvance: false, - captionOpacity: 0.8, - prevText: 'Prev', - nextText: 'Next', - randomStart: false, - beforeChange: function(){}, - afterChange: function(){}, - slideshowEnd: function(){}, - lastSlide: function(){}, - afterLoad: function(){} + 'effect': 'random', + 'slices': 15, + 'boxCols': 8, + 'boxRows': 4, + 'animSpeed': 500, + 'pauseTime': 3000, + 'startSlide': 0, + 'directionNav': true, + 'directionNavHide': true, + 'controlNav': true, + 'controlNavThumbs': false, + 'controlNavThumbsFromRel': false, + 'controlNavThumbsSearch': '.jpg', + 'controlNavThumbsReplace': '_thumb.jpg', + 'keyboardNav': true, + 'pauseOnHover': true, + 'manualAdvance': false, + 'captionOpacity': 0.8, + 'prevText': 'Prev', + 'nextText': 'Next', + 'randomStart': false, + 'beforeChange': function(){}, + 'afterChange': function(){}, + 'slideshowEnd': function(){}, + 'lastSlide': function(){}, + 'afterLoad': function(){} }; - + $.fn._reverse = [].reverse; - + })(jQuery); \ No newline at end of file diff --git a/jquery.nivo.slider.pack.js b/jquery.nivo.slider.pack.js index 7bb2356..f800bc6 100644 --- a/jquery.nivo.slider.pack.js +++ b/jquery.nivo.slider.pack.js @@ -1,12 +1,29 @@ -/* - * jQuery Nivo Slider v2.7.1 - * http://nivo.dev7studios.com - * - * Copyright 2011, Gilbert Pellegrom - * Free to use and abuse under the MIT license. - * http://www.opensource.org/licenses/mit-license.php - * - * March 2010 - */ - -(function(a){var b=function(b,c){var d=a.extend({},a.fn.nivoSlider.defaults,c);var e={currentSlide:0,currentImage:"",totalSlides:0,running:false,paused:false,stop:false};var f=a(b);f.data("nivo:vars",e);f.css("position","relative");f.addClass("nivoSlider");var g=f.children();g.each(function(){var b=a(this);var c="";if(!b.is("img")){if(b.is("a")){b.addClass("nivo-imageLink");c=b}b=b.find("img:first")}var d=b.width();if(d==0)d=b.attr("width");var g=b.height();if(g==0)g=b.attr("height");if(d>f.width()){f.width(d)}if(g>f.height()){f.height(g)}if(c!=""){c.css("display","none")}b.css("display","none");e.totalSlides++});if(d.randomStart){d.startSlide=Math.floor(Math.random()*e.totalSlides)}if(d.startSlide>0){if(d.startSlide>=e.totalSlides)d.startSlide=e.totalSlides-1;e.currentSlide=d.startSlide}if(a(g[e.currentSlide]).is("img")){e.currentImage=a(g[e.currentSlide])}else{e.currentImage=a(g[e.currentSlide]).find("img:first")}if(a(g[e.currentSlide]).is("a")){a(g[e.currentSlide]).css("display","block")}f.css("background",'url("'+e.currentImage.attr("src")+'") no-repeat');f.append(a('

').css({display:"none",opacity:d.captionOpacity}));a(".nivo-caption",f).css("opacity",0);var h=function(b){var c=a(".nivo-caption",f);if(e.currentImage.attr("title")!=""&&e.currentImage.attr("title")!=undefined){var d=e.currentImage.attr("title");if(d.substr(0,1)=="#")d=a(d).html();if(c.css("opacity")!=0){c.find("p").stop().fadeTo(b.animSpeed,0,function(){a(this).html(d);a(this).stop().fadeTo(b.animSpeed,1)})}else{c.find("p").html(d)}c.stop().fadeTo(b.animSpeed,b.captionOpacity)}else{c.stop().fadeTo(b.animSpeed,0)}};h(d);var i=0;if(!d.manualAdvance&&g.length>1){i=setInterval(function(){o(f,g,d,false)},d.pauseTime)}if(d.directionNav){f.append('");if(d.directionNavHide){a(".nivo-directionNav",f).hide();f.hover(function(){a(".nivo-directionNav",f).show()},function(){a(".nivo-directionNav",f).hide()})}a("a.nivo-prevNav",f).live("click",function(){if(e.running)return false;clearInterval(i);i="";e.currentSlide-=2;o(f,g,d,"prev")});a("a.nivo-nextNav",f).live("click",function(){if(e.running)return false;clearInterval(i);i="";o(f,g,d,"next")})}if(d.controlNav){var j=a('
');f.append(j);for(var k=0;k')}else{j.append('')}}else{j.append(''+(k+1)+"")}}a(".nivo-controlNav a:eq("+e.currentSlide+")",f).addClass("active");a(".nivo-controlNav a",f).live("click",function(){if(e.running)return false;if(a(this).hasClass("active"))return false;clearInterval(i);i="";f.css("background",'url("'+e.currentImage.attr("src")+'") no-repeat');e.currentSlide=a(this).attr("rel")-1;o(f,g,d,"control")})}if(d.keyboardNav){a(window).keypress(function(a){if(a.keyCode=="37"){if(e.running)return false;clearInterval(i);i="";e.currentSlide-=2;o(f,g,d,"prev")}if(a.keyCode=="39"){if(e.running)return false;clearInterval(i);i="";o(f,g,d,"next")}})}if(d.pauseOnHover){f.hover(function(){e.paused=true;clearInterval(i);i=""},function(){e.paused=false;if(i==""&&!d.manualAdvance){i=setInterval(function(){o(f,g,d,false)},d.pauseTime)}})}f.bind("nivo:animFinished",function(){e.running=false;a(g).each(function(){if(a(this).is("a")){a(this).css("display","none")}});if(a(g[e.currentSlide]).is("a")){a(g[e.currentSlide]).css("display","block")}if(i==""&&!e.paused&&!d.manualAdvance){i=setInterval(function(){o(f,g,d,false)},d.pauseTime)}d.afterChange.call(this)});var m=function(b,c,d){for(var e=0;e').css({left:f*e+"px",width:b.width()-f*e+"px",height:"0px",opacity:"0",background:'url("'+d.currentImage.attr("src")+'") no-repeat -'+(f+e*f-f)+"px 0%"}))}else{b.append(a('
').css({left:f*e+"px",width:f+"px",height:"0px",opacity:"0",background:'url("'+d.currentImage.attr("src")+'") no-repeat -'+(f+e*f-f)+"px 0%"}))}}};var n=function(b,c,d){var e=Math.round(b.width()/c.boxCols);var f=Math.round(b.height()/c.boxRows);for(var g=0;g').css({opacity:0,left:e*h+"px",top:f*g+"px",width:b.width()-e*h+"px",height:f+"px",background:'url("'+d.currentImage.attr("src")+'") no-repeat -'+(e+h*e-e)+"px -"+(f+g*f-f)+"px"}))}else{b.append(a('
').css({opacity:0,left:e*h+"px",top:f*g+"px",width:e+"px",height:f+"px",background:'url("'+d.currentImage.attr("src")+'") no-repeat -'+(e+h*e-e)+"px -"+(f+g*f-f)+"px"}))}}}};var o=function(b,c,d,e){var f=b.data("nivo:vars");if(f&&f.currentSlide==f.totalSlides-1){d.lastSlide.call(this)}if((!f||f.stop)&&!e)return false;d.beforeChange.call(this);if(!e){b.css("background",'url("'+f.currentImage.attr("src")+'") no-repeat')}else{if(e=="prev"){b.css("background",'url("'+f.currentImage.attr("src")+'") no-repeat')}if(e=="next"){b.css("background",'url("'+f.currentImage.attr("src")+'") no-repeat')}}f.currentSlide++;if(f.currentSlide==f.totalSlides){f.currentSlide=0;d.slideshowEnd.call(this)}if(f.currentSlide<0)f.currentSlide=f.totalSlides-1;if(a(c[f.currentSlide]).is("img")){f.currentImage=a(c[f.currentSlide])}else{f.currentImage=a(c[f.currentSlide]).find("img:first")}if(d.controlNav){a(".nivo-controlNav a",b).removeClass("active");a(".nivo-controlNav a:eq("+f.currentSlide+")",b).addClass("active")}h(d);a(".nivo-slice",b).remove();a(".nivo-box",b).remove();var g=d.effect;if(d.effect=="random"){var i=new Array("sliceDownRight","sliceDownLeft","sliceUpRight","sliceUpLeft","sliceUpDown","sliceUpDownLeft","fold","fade","boxRandom","boxRain","boxRainReverse","boxRainGrow","boxRainGrowReverse");g=i[Math.floor(Math.random()*(i.length+1))];if(g==undefined)g="fade"}if(d.effect.indexOf(",")!=-1){var i=d.effect.split(",");g=i[Math.floor(Math.random()*i.length)];if(g==undefined)g="fade"}if(f.currentImage.attr("data-transition")){g=f.currentImage.attr("data-transition")}f.running=true;if(g=="sliceDown"||g=="sliceDownRight"||g=="sliceDownLeft"){m(b,d,f);var j=0;var k=0;var l=a(".nivo-slice",b);if(g=="sliceDownLeft")l=a(".nivo-slice",b)._reverse();l.each(function(){var c=a(this);c.css({top:"0px"});if(k==d.slices-1){setTimeout(function(){c.animate({height:"100%",opacity:"1.0"},d.animSpeed,"",function(){b.trigger("nivo:animFinished")})},100+j)}else{setTimeout(function(){c.animate({height:"100%",opacity:"1.0"},d.animSpeed)},100+j)}j+=50;k++})}else if(g=="sliceUp"||g=="sliceUpRight"||g=="sliceUpLeft"){m(b,d,f);var j=0;var k=0;var l=a(".nivo-slice",b);if(g=="sliceUpLeft")l=a(".nivo-slice",b)._reverse();l.each(function(){var c=a(this);c.css({bottom:"0px"});if(k==d.slices-1){setTimeout(function(){c.animate({height:"100%",opacity:"1.0"},d.animSpeed,"",function(){b.trigger("nivo:animFinished")})},100+j)}else{setTimeout(function(){c.animate({height:"100%",opacity:"1.0"},d.animSpeed)},100+j)}j+=50;k++})}else if(g=="sliceUpDown"||g=="sliceUpDownRight"||g=="sliceUpDownLeft"){m(b,d,f);var j=0;var k=0;var o=0;var l=a(".nivo-slice",b);if(g=="sliceUpDownLeft")l=a(".nivo-slice",b)._reverse();l.each(function(){var c=a(this);if(k==0){c.css("top","0px");k++}else{c.css("bottom","0px");k=0}if(o==d.slices-1){setTimeout(function(){c.animate({height:"100%",opacity:"1.0"},d.animSpeed,"",function(){b.trigger("nivo:animFinished")})},100+j)}else{setTimeout(function(){c.animate({height:"100%",opacity:"1.0"},d.animSpeed)},100+j)}j+=50;o++})}else if(g=="fold"){m(b,d,f);var j=0;var k=0;a(".nivo-slice",b).each(function(){var c=a(this);var e=c.width();c.css({top:"0px",height:"100%",width:"0px"});if(k==d.slices-1){setTimeout(function(){c.animate({width:e,opacity:"1.0"},d.animSpeed,"",function(){b.trigger("nivo:animFinished")})},100+j)}else{setTimeout(function(){c.animate({width:e,opacity:"1.0"},d.animSpeed)},100+j)}j+=50;k++})}else if(g=="fade"){m(b,d,f);var q=a(".nivo-slice:first",b);q.css({height:"100%",width:b.width()+"px"});q.animate({opacity:"1.0"},d.animSpeed*2,"",function(){b.trigger("nivo:animFinished")})}else if(g=="slideInRight"){m(b,d,f);var q=a(".nivo-slice:first",b);q.css({height:"100%",width:"0px",opacity:"1"});q.animate({width:b.width()+"px"},d.animSpeed*2,"",function(){b.trigger("nivo:animFinished")})}else if(g=="slideInLeft"){m(b,d,f);var q=a(".nivo-slice:first",b);q.css({height:"100%",width:"0px",opacity:"1",left:"",right:"0px"});q.animate({width:b.width()+"px"},d.animSpeed*2,"",function(){q.css({left:"0px",right:""});b.trigger("nivo:animFinished")})}else if(g=="boxRandom"){n(b,d,f);var r=d.boxCols*d.boxRows;var k=0;var j=0;var s=p(a(".nivo-box",b));s.each(function(){var c=a(this);if(k==r-1){setTimeout(function(){c.animate({opacity:"1"},d.animSpeed,"",function(){b.trigger("nivo:animFinished")})},100+j)}else{setTimeout(function(){c.animate({opacity:"1"},d.animSpeed)},100+j)}j+=20;k++})}else if(g=="boxRain"||g=="boxRainReverse"||g=="boxRainGrow"||g=="boxRainGrowReverse"){n(b,d,f);var r=d.boxCols*d.boxRows;var k=0;var j=0;var t=0;var u=0;var v=new Array;v[t]=new Array;var s=a(".nivo-box",b);if(g=="boxRainReverse"||g=="boxRainGrowReverse"){s=a(".nivo-box",b)._reverse()}s.each(function(){v[t][u]=a(this);u++;if(u==d.boxCols){t++;u=0;v[t]=new Array}});for(var w=0;w=0&&x=g.h)g.c=0,b.V.call(this);else if(g.c<0)g.c=g.h-1;a.W=a.d;a.d=e(a.i[g.c]);g.S=g.b;g.b=a.d.is("img")?a.d:a.d.find("img").eq(0);g.b={url:g.b.attr("src"),title:g.b.attr("title"),B:g.b.data("transition")}; +b.w&&a.A.removeClass("active").eq(g.c).addClass("active");a.p&&a.p.css("display","none");x();e(".nivo-slice",a.a).remove();e(".nivo-box",a.a).remove();var c=b.o||"fade";b.o==="random"?(c=["sliceDownRight","sliceDownLeft","sliceUpRight","sliceUpLeft","sliceUpDown","sliceUpDownLeft","fold","fade","cycle","boxRandom","boxRain","boxRainReverse","boxRainGrow","boxRainGrowReverse"],c=c[Math.floor(Math.random()*(c.length-1))]):b.o.indexOf(",")!==-1&&(c=b.o.split(","),c=c[Math.floor(Math.random()*c.length)]); +if(g.b.B)c=g.b.B;g.m=!0;var f=function(d,c,e,f,g){setTimeout(function(){d.animate(c,e||b.e,"",g&&function(){a.a.trigger("nivo:animFinished")})},100+f)};switch(c){case "sliceDown":case "sliceDownRight":case "sliceDownLeft":r();var d=0,l=e(".nivo-slice",a.a),k=0,h;c==="sliceDownLeft"&&(l=l.n());do h=e(l[k]),h.css({top:"0"}),f(h,{height:"100%",opacity:1},o,d,k===b.f-1?!0:!1),d+=50;while(++k").css(d)[0]);k.appendChild(e("
").css(l)[0]);h.html(k);d={left:c?-f+"px":"0",width:f*2+"px",height:"100%",opacity:1};h.css(d).animate({left:c?"0":-f+"px"},b.e*2,"",function(){a.a.trigger("nivo:animFinished")});break;case "slideInHorizontal":case "slideInLeft":case "slideInRight":r(1);h=e(".nivo-slice",a.a);c=c==="slideInLeft"|| +c==="slideInHorizontal"&&(d==="prev"||d==="control"&&g.cg.l)?!0:!1;d={top:c?"0":"",bottom:c?"":"0",backgroundPosition:c?"0 100%": +"0 0",width:"100%",height:"0",opacity:1};h.css(d).animate({height:"100%"},b.e*2,"",function(){a.a.trigger("nivo:animFinished")});break;case "boxRandom":y();h=b.g*b.k;var d=0,j=w(e(".nivo-box",a.a)),i=0;do n=e(j[i]),f(n,{opacity:1},o,d,i===h-1?!0:!1),d+=20;while(++i=0&&m').css(i)[0])}while(++h').css(h)[0])}while(++ca.a.width()&&a.a.width(m),u>a.a.height()&&a.a.height(u),j.css("display","none"),++f.h;a.p&&a.p.addClass("nivo-imageLink");if(b.T)b.j=Math.floor(Math.random()*f.h);if(b.j>0){if(b.j>=f.h)b.j=f.h-1;f.l=b.j-1;f.c=b.j}a.d=e(a.i[f.c]);f.b=a.d.is("img")?a.d:a.d.find("img").eq(0);f.b={url:f.b.attr("src"),title:f.b.attr("title")};a.d.is("a")&& +a.d.css("display","block");a.a.css("background",'url("'+f.b.url+'") no-repeat').append(e('

').css({display:"none",opacity:b.v}));a.q=e(".nivo-caption",a.a);a.u=a.q.find("p");a.q.css("opacity",0);x();if(f.h<2)return!1;var i=o;b.s||(i=setInterval(function(){p(!1)},b.t));if(b.L)a.a.append('"),a.r=e(".nivo-directionNav",a.a),b.M&& +(a.r.hide(),a.a.hover(function(){a.r.show()},function(){a.r.hide()})),a.r.children().click(function(){var a=e(this).data("dir")||"next";if(f.m)return!1;clearInterval(i);i=o;a==="prev"&&(f.c-=2);p(a)});if(b.w){j=q="";for(m=a.i.length;--m+1;)b.G?(j=e(a.i[m]),j.is("img")||(j=j.find("img").eq(0)),j=b.H?'':''):j=m+1,q=''+j+""+q;a.a.append('
'+ +q+"
");a.U=e(".nivo-controlNav",a.a);a.A=a.U.find("a");a.A.click(function(){var b=e(this);if(f.m||b.hasClass("active"))return!1;clearInterval(i);i=o;a.a.css("background",'url("'+f.b.url+'") no-repeat');f.c=b.data("slide")-1;p("control")}).eq(f.c).addClass("active")}b.N&&e(document).keydown(function(a){a=a.keyCode||a.which;if(f.m)return!1;clearInterval(i);i=o;a===37||a===63234?(f.c-=2,p("prev")):(a===39||a===63235)&&p("next")});b.Q&&a.a.hover(function(){f.paused=!0;clearInterval(i);i=o},function(){f.paused= +!1;i===o&&!b.s&&(i=setInterval(function(){p(!1)},b.t))});a.a.bind("nivo:animFinished",function(){f.m=!1;a.d.is("a")&&a.d.css("display","block");i===o&&!f.paused&&!b.s&&(i=setInterval(function(){p(!1)},b.t));b.C.call(this)});this.stop=function(){if(!a.a.data("nivo:vars").stop)a.a.data("nivo:vars").stop=!0};this.start=function(){if(a.a.data("nivo:vars").stop)a.a.data("nivo:vars").stop=!1};b.D.call(this);return this}e.fn.nivoSlider=function(v){return this.each(function(){var t=e(this);if(t.data("nivoslider"))return t.data("nivoslider"); +var w=new z(this,v);t.data("nivoslider",w)})};e.fn.nivoSlider.K={effect:"random",slices:15,boxCols:8,boxRows:4,animSpeed:500,pauseTime:3E3,startSlide:0,directionNav:!0,directionNavHide:!0,controlNav:!0,controlNavThumbs:!1,controlNavThumbsFromRel:!1,controlNavThumbsSearch:".jpg",controlNavThumbsReplace:"_thumb.jpg",keyboardNav:!0,pauseOnHover:!0,manualAdvance:!1,captionOpacity:0.8,prevText:"Prev",nextText:"Next",randomStart:!1,beforeChange:s(),afterChange:s(),slideshowEnd:s(),lastSlide:s(),afterLoad:s()};e.fn.n= +[].reverse})(jQuery); \ No newline at end of file diff --git a/nivo-slider.css b/nivo-slider.css index 4fd76ea..e4228fb 100644 --- a/nivo-slider.css +++ b/nivo-slider.css @@ -13,6 +13,7 @@ /* The Nivo Slider styles */ .nivoSlider { position:relative; + overflow:hidden; } .nivoSlider img { position:absolute;