0

I am trying to achieve infinite scrolling for my view results in Drupal.

Now It could have been easier if I could use Views Infinite Scroll module but I couldn't use as it doesn't allow Views Ajax. Since I am using filters that heavily rely on AJAX, I am out of luck for using this module.

As I read, there is another option through Views Load More module, but it can only allow infinite scroll through Waypoints. This is where my problem lies as I am unable to understand how to use waypoints with Views Load More module.

I'll be super grateful if you could assist me in this.

This is Waypoints code from their site:-

var waypoint = new Waypoint({
  element: document.getElementById('#waypoint'),
  handler: function(direction) {
    console.log('Scrolled to waypoint!')
  }
})
2

It's actually really easy to do with standard Views and jQuery.autopager in your theme.

The most important part is using the correct classes, I can't find my working example at the moment, but it should look something like:

$.autopager({
  // where contents would be appended.
  // use "appendTo" or "insertBefore"
  appendTo: '.views-content',

  // a selector that matches a element of next page link
  link: '.pagination .next a:first',

  // a selector that matches page contents
  content: '.views-row',
});
1

You can have a try for Views Infinite Scroll module as now, its in stable 8.x-1.3 version.

3
  • Hello for 8.x1.3 gives error like info file is not exits. can you please provide solutions for that. Jun 20 '17 at 5:57
  • @DineshBhojvani: Can you please paste your error here. Jun 21 '17 at 7:25
  • ajax.js?v=7.54:546 Uncaught TypeError: wrapper[method] is not a function I am getting this error is it due to in my html there is not any div has wrapper class. Jun 22 '17 at 5:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.