javascriptinfinite-scrolltumblrtumblr-themestumblr-html

Infinite Scrolling creates pagination sublink as I scroll


I've finally worked out Infinite Scrolling thanks to what lharby has commented on my last post.
Thank you so much!
The problem is that the script creates a new pagination link as I exceeded scrolling for 15 posts (the amount of posts-per-page that I set for my Tumblr)
f.e : assets.txmblr.com =======> assets.txmblr.com /page/(2;3;4;...)
Thank you for the help !

Code (line 210 -> line 225)

        <script>
window.onload = function() {
var elem = document.getElementById('content');
let infScroll = new InfiniteScroll(elem, {
path: '.pagination__next',
append: '.post'
});
}
</script>
</head>

<body>
{block:NextPage}
<a href="{NextPage}" class="pagination__next"></a>
{/block:NextPage}

Solution

  • Some good news, I downloaded the full zip package here: https://infinite-scroll.com/infinite-scroll-docs.zip

    On lines 1340 to 1343 is the call to the function to update the url

    // update URL
    proto.onPageLoadHistory = function( response, path ) {
      this.setHistory( response.title, path );
    };
    

    If you comment this out I believe the page will no longer refresh the url.

    However as stated you need to download the file, modify it, then either host it or put it in your theme. If you add it into the theme you would want to minify it first.