How to add "Back to top" link at bottom at <div> is browser window is shorter than page, using jquer

Posted by metal-gear-solid on Stack Overflow See other posts from Stack Overflow or by metal-gear-solid
Published on 2010-05-17T17:08:04Z Indexed on 2010/05/17 17:10 UTC
Read the original article Hit count: 132

Filed under:
|
|

How to add "Back to top" link at bottom at is browser window is shorter than page, using jquery?

<div id="mainContent">

<p>Some content</p>

</div>

If some content is bigger than browser window ( I mean if vertical bar comes on the page) then i want to add Back to top just before closing the div.

<div id="mainContent">

<p>Some content</p>

<p>Some content</p>

<p>Some content</p>

<a href="#"> Back to top </a>

</div>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript