Hi,

I ran into this problem when the Page is initially loaded and no Scroll Event has been fired jet. The autoloader image is shown even no load new content event has been triggered.

The Easiest way to replicate this is to create a view with small content like just headlines and have 4 displayed per page. I attached an Image the Drupal installation is fresh and only required modules are enabled.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Andrew@Germany created an issue. See original summary.

AndrewTur’s picture

Issue summary: View changes
FileSize
34.67 KB
AndrewTur’s picture

Version: 7.x-2.0 » 7.x-2.x-dev
AndrewTur’s picture

I found a way so that the Image only get appended when the click ist triggered by scrolling and there is no image already appended.

if ($pager.find('.pager__item a').length) {
  $('.pager__item a', context).once().bind( 'click', function () {
    if (!$('.views_infinite_scroll-ajax-loader').length) {
      $pager.append(loadingImg);
    }
  });
}

I will create a patch soon.
Btw a debounce function would also be nice probably so that the scroll does not trigger hundreds of clicks.

AndrewTur’s picture

AndrewTur’s picture

Status: Active » Needs review
krina.addweb’s picture

FileSize
74.46 KB

Patch works well with given Drupal version. PFA screenshots of the same.

krina.addweb’s picture

Status: Needs review » Reviewed & tested by the community
AndrewTur’s picture

Rerolled pacth against stable 2.1

Honza Pobořil’s picture

Status: Reviewed & tested by the community » Needs review

More reviews that it does not brake things with current dev, please.