I need the browser to scroll my ASP.NET page to the top when the user clicks on a server-side link or button at the bottom of the page.
<div id="box" style=" position: fixed; bottom:5px;">
<a href="#top" >Back to up<img height="40" src="../images/btnup.png" /></a>
I use this code for it:
$(document).ready(function () {
$('a[href=#top]').click(function () {
$('html, body').animate({ scrollTop: 0 }, 'slow');
return false;
});
});
I want to show this button when the scroll position is at the bottom of the page and don't want to show this when the scroll position is at the top of the page.
How to view this button when the scroll position is at the bottom of the page?