在页面底部加载一个站点

时间:2022-01-10 19:23:34

I am working on a build for a client of mine and they are wanting this page to load at the bottom of the site, and then the user scrolls up through the site. So basically, the site is built backwards. This site is built on WordPress and I am using Divi, by Elegant Themes as my framework. I have spent the last three hours researching this online and I have also submitted a ticket to Elegant Themes. For the life of me, I cannot figure this out.

我正在为我的客户进行构建,他们希望在网站底部加载此页面,然后用户向上滚动浏览网站。基本上,该网站是向后构建的。这个网站建立在WordPress上,我使用Divi,优雅主题作为我的框架。我花了最近三个小时在网上研究这个,我还提交了一个优雅主题的门票。对于我的生活,我无法弄清楚这一点。

I have tried creating an ID at the bottom of the page and I was planning on completing a 301 redirect. This is not working either as the page loads, then scrolls, and completes the scroll too high. I need the page to load with the footer at the very bottom of the page. The link to the dev site is below.

我尝试在页面底部创建一个ID,我计划完成301重定向。这不会在页面加载,然后滚动,并完成滚动太高时工作。我需要页面加载页面最底部的页脚。 dev站点的链接如下。

http://dev.narratorgroup.com

2 个解决方案

#1


2  

This is very simple and does not require jQuery or a cover image or an animation. All you have to do is use the DOM API to select the body element and set it's scroll position to the body's height.

这非常简单,不需要jQuery或封面图像或动画。您所要做的就是使用DOM API选择body元素并将其滚动位置设置为body的高度。

The CSS here is just to simulate overflow on the body.

这里的CSS只是为了模拟身体上的溢出。

document.body.scrollTop = document.body.scrollHeight;
html, body { height: 200%; }


If you wrap it like this and there is no other document.onload handler defined then you can place this anywhere in the document

如果你像这样包装它并且没有定义其他document.onload处理程序,那么你可以将它放在文档中的任何位置

<script>
    document.onload = function() {
        document.body.scrollTop = document.body.scrollHeight;
    }
<script>

#2


0  

<script>
        var main = function() {
            window.scrollTo(0,document.body.scrollHeight);
        }
        $(document).ready(main);
    </script>

EDIT: Requires jQuery.

编辑:需要jQuery。

Example: http://jsfiddle.net/f74uk171/

#1


2  

This is very simple and does not require jQuery or a cover image or an animation. All you have to do is use the DOM API to select the body element and set it's scroll position to the body's height.

这非常简单,不需要jQuery或封面图像或动画。您所要做的就是使用DOM API选择body元素并将其滚动位置设置为body的高度。

The CSS here is just to simulate overflow on the body.

这里的CSS只是为了模拟身体上的溢出。

document.body.scrollTop = document.body.scrollHeight;
html, body { height: 200%; }


If you wrap it like this and there is no other document.onload handler defined then you can place this anywhere in the document

如果你像这样包装它并且没有定义其他document.onload处理程序,那么你可以将它放在文档中的任何位置

<script>
    document.onload = function() {
        document.body.scrollTop = document.body.scrollHeight;
    }
<script>

#2


0  

<script>
        var main = function() {
            window.scrollTo(0,document.body.scrollHeight);
        }
        $(document).ready(main);
    </script>

EDIT: Requires jQuery.

编辑:需要jQuery。

Example: http://jsfiddle.net/f74uk171/