0

how to make page up link

i have to make link in my site when user click it shows a top view of site "i mean it goes to header of my site"

Nikita Rybak
  • 67,365
  • 22
  • 157
  • 181

3 Answers3

3

You can use # as "URL":

<a href="#"> Go Up <a/>

No JavaScript required.

Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
1
$(function() {
    $('a#top').click(function() {
        $('html,body').animate({'scrollTop' : 0},1000);
    });
});

Test it here : http://jsbin.com/ucati4

0

What about giving your header some id (e.g., 'header') and making a link to it (<a href="#header">go up</a>)? Simple enough.

Nikita Rybak
  • 67,365
  • 22
  • 157
  • 181