/*! * jQuery.scrollTo * Copyright (c) 2007-2015 Ariel Flesler - aflesler ○ gmail • com | http://flesler.blogspot.com * Licensed under MIT * http://flesler.blogspot.com/2007/10/jqueryscrollto.html * @projectDescription Lightweight, cross-browser and highly customizable animated scrolling with jQuery * @author Ariel Flesler * @version 2.1.2 */ !function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"undefined"!=typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){"use strict";function b(b){return!b.nodeName||-1!==a.inArray(b.nodeName.toLowerCase(),["iframe","#document","html","body"])}function c(b){return a.isFunction(b)||a.isPlainObject(b)?b:{top:b,left:b}}var d=a.scrollTo=function(b,c,d){return a(window).scrollTo(b,c,d)};return d.defaults={axis:"xy",duration:0,limit:!0},a.fn.scrollTo=function(e,f,g){"object"==typeof f&&(g=f,f=0),"function"==typeof g&&(g={onAfter:g}),"max"===e&&(e=9e9),g=a.extend({},d.defaults,g),f=f||g.duration;var h=g.queue&&g.axis.length>1;return h&&(f/=2),g.offset=c(g.offset),g.over=c(g.over),this.each(function(){function i(b){var c=a.extend({},g,{queue:!0,duration:f,complete:b&&function(){b.call(l,n,g)}});m.animate(o,c)}if(null!==e){var j,k=b(this),l=k?this.contentWindow||window:this,m=a(l),n=e,o={};switch(typeof n){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(n)){n=c(n);break}n=k?a(n):a(n,l);case"object":if(0===n.length)return;(n.is||n.style)&&(j=(n=a(n)).offset())}var p=a.isFunction(g.offset)&&g.offset(l,n)||g.offset;a.each(g.axis.split(""),function(a,b){var c="x"===b?"Left":"Top",e=c.toLowerCase(),f="scroll"+c,q=m[f](),r=d.max(l,b);if(j)o[f]=j[e]+(k?0:q-m.offset()[e]),g.margin&&(o[f]-=parseInt(n.css("margin"+c),10)||0,o[f]-=parseInt(n.css("border"+c+"Width"),10)||0),o[f]+=p[e]||0,g.over[e]&&(o[f]+=n["x"===b?"width":"height"]()*g.over[e]);else{var s=n[e];o[f]=s.slice&&"%"===s.slice(-1)?parseFloat(s)/100*r:s}g.limit&&/^\d+$/.test(o[f])&&(o[f]=o[f]<=0?0:Math.min(o[f],r)),!a&&g.axis.length>1&&(q===o[f]?o={}:h&&(i(g.onAfterFirst),o={}))}),i(g.onAfter)}})},d.max=function(c,d){var e="x"===d?"Width":"Height",f="scroll"+e;if(!b(c))return c[f]-a(c)[e.toLowerCase()]();var g="client"+e,h=c.ownerDocument||c.document,i=h.documentElement,j=h.body;return Math.max(i[f],j[f])-Math.min(i[g],j[g])},a.Tween.propHooks.scrollLeft=a.Tween.propHooks.scrollTop={get:function(b){return a(b.elem)[b.prop]()},set:function(b){var c=this.get(b);if(b.options.interrupt&&b._last&&b._last!==c)return a(b.elem).stop();var d=Math.round(b.now);c!==d&&(a(b.elem)[b.prop](d),b._last=this.get(b))}},d});