If you uncheck the box for "Add views row classes" under format settings, this module will not work. It needs the default views row classes and I believe it should work with less class clutter. The JS for this module could be better optimized for this. Just a heads up since I couldn't find this anywhere and I only figured it out by looking at the script. I'll submit a patch sometime I get some free time.

Comments

askibinski’s picture

Category: support » bug

I can confirm this issue.

If the checkbox is unchecked, a JS error will occur:

Uncaught TypeError: Cannot read property 'top' of null 

at views_infinite_scroll.js, line 51:

..

            // Trigger autoload if content height is less than doc height already
            var prev_content_height = $(content_selector).height();
            do {
              var last = $(items_selector).filter(':last');
              if(last.offset().top + last.height() < $(document).scrollTop() + $(window).height()) { // <----------- line 51
                last = $(items_selector).filter(':last');
                handle.autopager('load');
              }
              else {
                break;
              }
            }
..

If this is by design, I think it should be mentioned on the project page and/or readme.

Pentacor’s picture

+1 this breaks the module in my eyes as I'm doing a lot with themed views output so don't want the extra divs and guff the default output gives me. There surely must be a workaround?!

Pentacor’s picture

+1 this breaks the module in my eyes as I'm doing a lot with themed views output so don't want the extra divs and guff the default output gives me. There surely must be a workaround?!

jibran’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
pxlr’s picture

I was going crazy trying to figure out what was wrong on my install, until I found this. I thought it was the jQuery Update module, or the autopager, or something else altogether. I'm using a custom row output in my tpl files to give the masonry-item divs a class based on author name (I needed to style them different colors based on author). All I did was add the class "views-row" manually into the "masonry-item" div and it's all working again.

Hope that helps someone else.

dooug’s picture

Title: Module will not work if the "Add views row classes" is not checked. » Module will not work if the ".views-row" class isn't used.

Closed a duplicate: #1983582: Allow default row classes to be disabled

I also had to manually add the views-row class to my template for this to work.

jamiehollern’s picture

I'd like to add to this and say that the module won't work if the default view wrapper classes are disabled. I use Mothership as a base theme and it removes the "view-id-[id]" and the "view-display-id-[display]" classes from the wrapper which causes this module to break.

For example, if I have a view called "work" and I want to use infinite scroll on the display "page" the module looks for div.view-id-work.view-display-id-page > div.view-content .views-row.filter(:last) Using the default Mothership settings, the first two classes are removed which causes this module to break.

jamiehollern’s picture

Issue summary: View changes

EDIT: Submitting patch sometime later

nlhnam’s picture

If I put in field "Wrapper class" another class instead of default "item-list" like "item-list my-own-class" it won't work either. Too bad for a good module.

maxplus’s picture

Hi,
I can confirm #8, I also have a custom wrapper class and de module indeed doesn't work...

jkirkby’s picture

Issue summary: View changes

+ #8

This needs to be better documented that it will break if you change these classes

bigssam’s picture

in your views display settings, you must add Add views row classes to the dom of your views by chekin the property "Add views row classes"

Regards.

interestingaftermath’s picture

In my case, I didn't want the div wrapper on my rows so I was able to just add "views-row" class to my row in the Global: Custom Text field.

Vacilando’s picture

Solved without having to switch on "Add views row classes" simply by adding class "views-row" under "Row class" in the Format settings.

flyke’s picture

Thanks for this thread. I could not figure out why my infinite scroll wasn't working. I was about to test a patch from this page: https://www.drupal.org/node/970870 when I ran into this thread and decided to first just try to check the option add views classes in my view. Now the infinite scroll works so i don't need any patch.

fbreckx’s picture

Doesn't work with Mothership / Semantic Views. Truly a shame ...
Will there be a new version any time soon?

pehka’s picture

Still doesn't work after adding the classes.

Edit:
- Format: HTML List
- Drupal 7.36, JQuery 1.10 , Views 3.1, Views Infinite Scroll 1.1
- no patches Applied yet
- Error: Uncaught TypeError: Cannot read property 'top' of undefined

Any ideas?

ean’s picture

Masonry API version = "7.x-3.0-beta1"
Views Infinite Scroll="7.x-1.2+1-dev"

Still doesn't work after adding the classes.
Error: Uncaught TypeError: Cannot read property 'top' of undefined

Honza Pobořil’s picture

Status: Active » Closed (outdated)