最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - How to have a web page load at the bottom of the site. - Stack Overflow

programmeradmin0浏览0评论

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 mand to explain what i mean is (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. (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 acplish this?

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

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

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 mand to explain what i mean is http://url./#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.. (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 acplish this?

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

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

Share Improve this question edited Mar 30, 2012 at 6:51 dan-lee 14.5k6 gold badges55 silver badges80 bronze badges asked Mar 30, 2012 at 6:22 WolVesWolVes 1,3463 gold badges20 silver badges44 bronze badges 2
  • did you try javascript onload? – hjpotter92 Commented Mar 30, 2012 at 6:26
  • Um no, this is looks like it would work pretty well if there is no other way, but it would be slightly slower, but definitely better than nothing! Iv never used this script before and the example is for text, how would you set it for a redirect? Thanks! Does anyone else know a faster way? – WolVes Commented Mar 30, 2012 at 6:34
Add a ment  | 

4 Answers 4

Reset to default 2

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>
<body onload="window.location.hash = 'footer'">

Where the footer has id="footer".

This can be useful for you.

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

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

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>
发布评论

评论列表(0)

  1. 暂无评论