When using infinitescroll after using the language switcher, there is a language attribute appended after the page param. This breaks infinitescroll. I have worked around it with a pathParse function like:

pathParse: function(path, currentPage) {
      var pathSplit = path.split('&page=1');
      return [pathSplit[0] + '&page=', pathSplit[1]];
    },

I am not using this as a module because I just found out about this module when searching for a fix (also using it with isotope), so not sure if this is already fixed.

Comments

sokrplare’s picture

Issue summary: View changes
StatusFileSize
new539 bytes

Looks like OP cross-posted in the Github jQuery plugin issue queue (https://github.com/paulirish/infinite-scroll/issues/360) and got the below reply:

This is not a bug. The plugin attempts to make a guess at your URL scheme, but ultimately it is up to you to define it.

Another more generalized issue (https://github.com/paulirish/infinite-scroll/issues/506) reply:

Yes, this is an issue with how infinite scroll automatically parses your URLs. If your URL scheme is different than the one that's expected, try using the path or pathParse options to tell the plugin where to find the next page.

Thankfully, the pathParse the OP wrote does fix things. I feel like there might be a more generalized handling case, but my JS chops are not ready on a Monday. Just adding this as a patch - since jquery.infinitescroll.js isn't officially part of the module - more for my own reference.

Method to apply (roughly - read the other thread as well to get the plugin itself etc.):

  1. Apply patch #1806628-44: Support Masonry module (direct patch link)
  2. Apply patch #1806628-50: Support Masonry module (direct patch link)
  3. Apply patch attached to this comment.

Examples that break it without specifying a pathParse function:

  • ?page=2
  • ?breakit
  • #breakfragment

With this pathParse function you instead get:

  • ?page=2 - now works as normal
  • ?breakit - now works, but doesn't ever add the page parameter even as it pages
  • #breakfragment - oddly switches the fragment to be appended to the path (looks like part of the infinite-scroll plugin itself, not related to this patch paticularly maybe), then uses the page parameter as normal
honza pobořil’s picture

Status: Active » Closed (outdated)