|
|
|
@ -1,11 +1,11 @@
|
|
|
|
|
/*! |
|
|
|
|
* jQuery.scrollTo |
|
|
|
|
* Copyright (c) 2007-2015 Ariel Flesler - aflesler<a>gmail<d>com | http://flesler.blogspot.com
|
|
|
|
|
* Copyright (c) 2007 Ariel Flesler - aflesler ○ gmail • com | https://github.com/flesler
|
|
|
|
|
* Licensed under MIT |
|
|
|
|
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
|
|
|
|
|
* https://github.com/flesler/jquery.scrollTo
|
|
|
|
|
* @projectDescription Lightweight, cross-browser and highly customizable animated scrolling with jQuery |
|
|
|
|
* @author Ariel Flesler |
|
|
|
|
* @version 2.1.2 |
|
|
|
|
* @version 2.1.3 |
|
|
|
|
*/ |
|
|
|
|
;(function(factory) { |
|
|
|
|
'use strict'; |
|
|
|
@ -35,7 +35,12 @@
|
|
|
|
|
function isWin(elem) { |
|
|
|
|
return !elem.nodeName || |
|
|
|
|
$.inArray(elem.nodeName.toLowerCase(), ['iframe','#document','html','body']) !== -1; |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function isFunction(obj) { |
|
|
|
|
// Brought from jQuery since it's deprecated
|
|
|
|
|
return typeof obj === 'function' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$.fn.scrollTo = function(target, duration, settings) { |
|
|
|
|
if (typeof duration === 'object') { |
|
|
|
@ -68,7 +73,7 @@
|
|
|
|
|
var win = isWin(this), |
|
|
|
|
elem = win ? this.contentWindow || window : this, |
|
|
|
|
$elem = $(elem), |
|
|
|
|
targ = target,
|
|
|
|
|
targ = target, |
|
|
|
|
attr = {}, |
|
|
|
|
toff; |
|
|
|
|
|
|
|
|
@ -93,7 +98,7 @@
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var offset = $.isFunction(settings.offset) && settings.offset(elem, targ) || settings.offset; |
|
|
|
|
var offset = isFunction(settings.offset) && settings.offset(elem, targ) || settings.offset; |
|
|
|
|
|
|
|
|
|
$.each(settings.axis.split(''), function(i, axis) { |
|
|
|
|
var Pos = axis === 'x' ? 'Left' : 'Top', |
|
|
|
@ -180,11 +185,11 @@
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
function both(val) { |
|
|
|
|
return $.isFunction(val) || $.isPlainObject(val) ? val : { top:val, left:val }; |
|
|
|
|
return isFunction(val) || $.isPlainObject(val) ? val : { top:val, left:val }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Add special hooks so that window scroll properties can be animated
|
|
|
|
|
$.Tween.propHooks.scrollLeft =
|
|
|
|
|
$.Tween.propHooks.scrollLeft = |
|
|
|
|
$.Tween.propHooks.scrollTop = { |
|
|
|
|
get: function(t) { |
|
|
|
|
return $(t.elem)[t.prop](); |
|
|
|
|