This PR is about solving a bug where the vertical lazy loading stopped working when using a vertical and horizontal lazy load together on one page (problem video).
This problem was caused because there was never a scroll listener placed on the window object in this case. This is because both the vertical AND horizontal lazy load containers are using the same "listeners" array.
So when the first (horizontal) lazy load mounts, it adds listeners to the array and when the time comes that the second (vertical) lazy load mounts, the listeners array > 0 and the scroll listener is never attached.
To solve this problem I;
Switched the order of the if-else statement and make sure that for non-overflow elements, there's always a scroll listener attached to the window when there are none yet. (solution video)
Testing Info
I've re-run your test and they all seem to pass. I didn't go in-depth into the codebase, but if you see any problems with this merge, be sure to let me know asap.
There also seems to be a problem with the travis build server the last couple of months (not something that I caused). Could you look into this? @ameerthehacker
Description
This PR is about solving a bug where the vertical lazy loading stopped working when using a vertical and horizontal lazy load together on one page (problem video).
This problem was caused because there was never a scroll listener placed on the window object in this case. This is because both the vertical AND horizontal lazy load containers are using the same "listeners" array.
So when the first (horizontal) lazy load mounts, it adds listeners to the array and when the time comes that the second (vertical) lazy load mounts, the listeners array > 0 and the scroll listener is never attached.
To solve this problem I;
Testing Info