0

If you read an article on Reuters.com and scroll down to the bottom of the page, another article will show up, and the url changes. If you scroll back you see the previous page, with the previous url.

I have just three php pages that I would like to load one after the other, as one scrolls down the page. Is there a clean way to do that?

Something like:

Page1:

<code of Page1>
<append Page2 code>

Page2:

<code of Page2>
<append Page3 code>

Infinite scroll libraries, like jquery-ias don't seem to support such behavior, or at least I don't see how.

4

3 回答 3

0

无限滚动界面中的历史 Web API。

现场演示- 源代码

于 2018-04-10T22:45:35.517 回答
0

可以通过带有历史扩展的 Infinite Ajax Scroll 来实现。

在您的情况下,您需要在文章底部提供指向下一篇文章的链接。在 IAS 的配置中使用此链接。然后当您向下滚动时,IAS 将加载下一页并更新 url。

查看演示

于 2018-04-11T10:02:30.400 回答
0

这对我有用:

  1. 在页面末尾添加占位符 div:
<div id="2nd"></div>
<div id="3rd"></div>
  1. 这个 jquery 脚本:

    $("#2nd").load("all.php");
    $("#3rd").load("target.php");
    
于 2018-04-24T18:03:31.470 回答