/** * jQuery.ScrollTo * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * Date: 2/19/2008 * * @projectDescription Easy element scrolling using jQuery. * Tested with jQuery 1.2.1. On FF 2.0.0.11, IE 6, Opera 9.22 and Safari 3 beta. on Windows. * * @author Ariel Flesler * @version 1.3.3 * * @id jQuery.scrollTo * @id jQuery.fn.scrollTo * @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements. * The different options for target are: * - A number position (will be applied to all axes). * - A string position ('44', '100px', '+=90', etc ) will be applied to all axes * - A jQuery/DOM element ( logically, child of the element to scroll ) * - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc ) * - A hash { top:x, left:y }, x and y can be any kind of number/string like above. * @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead. * @param {Object} settings Hash of settings, optional. * @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'. * @option {Number} duration The OVERALL length of the animation. * @option {String} easing The easing method for the animation. * @option {Boolean} margin If true, the margin of the target element will be deducted from the final position. * @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }. * @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes. * @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends. * @option {Function} onAfter Function to be called after the scrolling ends. * @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends. * @return {jQuery} Returns the same jQuery object, for chaining. * * @example $('div').scrollTo( 340 ); * * @example $('div').scrollTo( '+=340px', { axis:'y' } ); * * @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } ); * * @example var second_child = document.getElementById('container').firstChild.nextSibling; * $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){ * alert('scrolled!!'); * }}); * * @example $('div').scrollTo( { top: 300, left:'+=200' }, { offset:-20 } ); * * Notes: * - jQuery.scrollTo will make the whole window scroll, it accepts the same arguments as jQuery.fn.scrollTo. * - If you are interested in animated anchor navigation, check http://jquery.com/plugins/project/LocalScroll. * - The options margin, offset and over are ignored, if the target is not a jQuery object or a DOM element. * - The option 'queue' won't be taken into account, if only 1 axis is given. */ eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}(';(7($){p $a=$.a=7(h,6,3){$a.E().a(h,6,3)};$a.L={c:\'y\',6:1};$a.E=7(){r $($.P.X?\'B\':\'K\')};$.U.a=7(h,6,3){8(v 6==\'z\'){3=6;6=0}3=$.18({},$a.L,3);6=6||3.14||3.6;3.m=3.m&&3.c.15>1;8(3.m)6/=2; 3.g=q(3.g);3.l=q(3.l);r k.I(7(){p 9=k,$9=$(9),t=h,o,4={},A=$9.J(\'K,B\');16(v t){s\'11\':s\'10\':8(/^([+-]=)?\\d+(V)?$/.O(t)){t=q(t);T}t=$(t,k);s\'z\':8(t.J||t.Y)o=(t=$(t)).g()}$.I(3.c.19(\'\'),7(i,c){p j=c==\'x\'?\'1j\':\'1m\',b=j.M(),5=\'S\'+j,w=9[5],e=c==\'x\'?\'D\':\'1i\',F=e.M();8(o){4[5]=o[b]+(A?0:w-$9.g()[b]);8(3.H){4[5]-=G(t.N(\'H\'+j))||0;4[5]-=G(t.N(\'1b\'+j+\'D\'))||0}4[5]+=3.g[b]||0;8(3.l[b])4[5]+=t[F]()*3.l[b]}1d 4[5]=t[b];8(/^\\d+$/.O(4[5]))4[5]=4[5]<=0?0:1e.1f(4[5],R(e));8(!i&&3.m){8(w!=4[5])n(3.1c);1g 4[5]}});n(3.1h);7 n(C){$9.n(4,6,3.1l,C&&7(){C.1k(k,h)})};7 R(e){p u=A?$.P.17?Q.B:Q.W:9;r u[\'S\'+e]-u[\'12\'+e]}})};7 q(f){r v f==\'z\'?f:{13:f,Z:f}}})(1a);',62,85,'|||settings|attr|key|duration|function|if|elem|scrollTo|pos|axis||Dim|val|offset|target||Pos|this|over|queue|animate|toff|var|both|return|case||el|typeof|act|||object|win|body|callback|Width|window|dim|parseInt|margin|each|is|html|defaults|toLowerCase|css|test|browser|document|max|scroll|break|fn|px|documentElement|safari|style|left|string|number|client|top|speed|length|switch|opera|extend|split|jQuery|border|onAfterFirst|else|Math|min|delete|onAfter|Height|Left|call|easing|Top'.split('|'),0,{}))