Hello. One quick note to point out on the module. Since we are getting new content via AJAX, once it is loaded we should also call Drupal.attachBehaviors() to re-attach any javascript effects to this newly loaded content. For example, I maintain the Hover Preview module, which adds a javascript hover effect to images. The hover isn't applied to the newly loaded AJAX content.

Here's a reference:
http://drupal.org/node/114774#javascript-behaviors

Here's the relevant text:
Code should also be updated if it adds AJAX/AHAH loaded content. Developers implementing AHAH/AJAX in their solutions should call Drupal.attachBehaviors() after new page content has been loaded, feeding in an element to be processed, in order to attach all behaviors to the new content. Examples:

$(targetElt).html(response.data);
Drupal.attachBehaviors(targetElt);

or

var newContent = $(response.data).appendTo(elt);
Drupal.attachBehaviors(newContent[0]);

Comments

rjbrown99’s picture

It looks like the load: function of $.autopager in views_infinite_scroll.js is a good place to do that since it gets called after the content loads per their documentation:
http://lagoscript.org/jquery/autopager/documentation

        load: function() {
          $('div#views_infinite_scroll-ajax-loader').remove();
          Drupal.attachBehaviors(content_selector);
        }

I haven't tested it yet, just thinking out loud.

EDIT: Hmm, that isn't working so well - it keeps re-loading page 1 of the content every time you hit the fold to load new stuff.

rjbrown99’s picture

Perhaps something similar to this so infinite scroll isn't called multiple times when behaviors are attached:
http://www.opensourcery.com/blog/jonathan-hedstrom/simple-timed-events-j...

var hasrun = 0;
Drupal.behaviors.views_infinite_scroll = function() {
  if($.autopager && !hasrun) {
    hasrun = 1;
  }
};

... with a call to Drupal.attachBehaviors(content_selector); inside the load: of .autopager per #1.

Remon’s picture

Assigned: Unassigned » Remon

Confirmed! thanks for the bug report.

Remon’s picture

Status: Active » Fixed

Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.