How to have a web page load at the bottom of the s

2019-07-25 13:19发布

I am creating a reverse site, meaning the opening spot on the page is at the bottom and you scroll up to go through content. a simple command to explain what i mean is http://url.com/#bottom (or #footer). However i want to avoid having to create an "ENTER" site page that lines to #bottom and i cannot use a URL redirect to any #adress.

No im not trying to spoof some free server or something, you can checkout what im trying to do at Sean-holt.com. (note im still in the beginning of the work. but just go to the bottom and then scroll up, I want the site to open at the picture of the world).

I just want the first place the viewer to see is the bottom of the page and then have to scroll up.

How can i accomplish this?

Thanks a lot for your help!!!!! you guys rock!

(P.S. This is the first time i have used stack Overflow!)

4条回答
放我归山
2楼-- · 2019-07-25 13:36
<body onload="window.location.hash = 'footer'">

Where the footer has id="footer".

查看更多
Evening l夕情丶
3楼-- · 2019-07-25 13:46

Dan Lee's idea is great.. Just add or subtract something to achieve your ideal position.
I've done it like this:

<script>
        // after dom is loaded
        $(function() {
          // scroll all the way down
          $('html, body').scrollTop($(document).height() - ($(window).height() + 280));
        });
    </script>
查看更多
forever°为你锁心
4楼-- · 2019-07-25 13:48

I think you should do it with Javascript/jQuery instead of redirecting again

Put this in the head tag of your file

<script>
// after dom is loaded
$(function() {
  // scroll all the way down
  $('html, body').scrollTop($(document).height() - $(window).height());
});
</script>
查看更多
5楼-- · 2019-07-25 13:48

This can be useful for you.

http://demos.flesler.com/jquery/scrollTo/

I did not use this but may be useful for you.

查看更多
登录 后发表回答