[Support request] Infinitescrolling and the back button

Home Forums Support [Support request] Infinitescrolling and the back button

Home Forums Support Infinitescrolling and the back button

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1280775
    Mathieu

    Hi Tom,

    I’ve just notified that when a user scroll through a list of posts with your implementation of InfiniteScroll and press the back button, they aren’t coming back where they were.

    I tried to fix it with appending the URL (/page/2 , etc) on a page refresh using that code :

    jQuery(document).ready(function($) {
      var $maintain_navigation_infinite_scroll = $('#main article').first().parent();
      $maintain_navigation_infinite_scroll.on('load.infiniteScroll', function(event, response, path) {
        history.replaceState(null, '', path);
      });
    });

    And it’s better because they are coming back within the same rang of posts but I wonder if it’s something you already noticed or if you have a better fix? Because my solution doesn’t always work. Sometimes you press back and it goes to the bottom of the page and you also lost the opportunity to move to higher posts.

    Regards,

    #1281694
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    It seems infinite scroll has an option for this: https://infinite-scroll.com/options.html#history

    Unfortunately, the args we add in our javascript aren’t filterable, so it’s not possible to adjust them. I’ve made a note to filter these in 1.11.0 so things can be added/removed.

    #1281731
    Mathieu

    Thanks Tom.

    Have a nice week. Stay safe.

    #1282761
    Tom
    Lead Developer
    Lead Developer

    Thank you! You too 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.