<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml" ><Head> <title>Untitled Page</title> <Scripttype= "Text/javascript"src=jquery-1.8.0.js></Script> <Script>$ (document). Ready (function () { //When you click the top button, the ScrollTop property gets the distance of the selected label from the scroll bar. $('#top'). Click (function () { $('HTML'). Animate ({scrolltop:'0px' }, + ); }); //when clicking on the Bottom tab, the execution method, where offset () Gets the relative offset of the matching element at the current viewport, returns an object with two properties Top,left //Animate, the second property of course we can also set ' slow ', ' normal ' or ' fast ' $('#foot'). Click (function () { $('HTML'). Animate ({scrolltop:$ ('span'). Offset (). Top}, + ); }); }); </Script></Head><Body> <BR/> <BR/> <BR/> <BR/> <BR/> <ahref="#"ID= "Foot">Bottom</a> <BR/> <BR/> <BR/> <BR/> <BR/> <BR/> <BR/> <BR/> <BR/> <BR/> <ahref="#"ID= "Top">Top of</a> <BR/> <BR/> <BR/> <BR/> <BR/> <span></span></Body></HTML>
The simplest to animate with jquery jumps to the top and bottom