Commit a5c77016 authored by Remon's avatar Remon

Issue #1039036 by andrew_k, Remon: If the viewport doesn't have a scrollbar...

Issue #1039036 by andrew_k, Remon: If the viewport doesn't have a scrollbar then new content is never loaded.
parent 22e7188c
// $Id:
(function ($) {
var views_infinite_scroll_was_initialised = false;
Drupal.behaviors.views_infinite_scroll = {
attach:function() {
......@@ -30,7 +29,7 @@ Drupal.behaviors.views_infinite_scroll = {
var img_location = 'div.view-id-' + settings.view_name + '.view-display-id-' + settings.display + ' div.view-content';
var pager_selector = 'div.view-id-' + settings.view_name + '.view-display-id-' + settings.display + ' div.item-list ' + settings.pager_selector;
$(pager_selector).hide();
$.autopager({
var handle = $.autopager({
appendTo: content_selector,
content: items_selector,
link: next_selector,
......@@ -39,10 +38,25 @@ Drupal.behaviors.views_infinite_scroll = {
$(img_location).after(img);
},
load: function() {
$('div#views_infinite_scroll-ajax-loader').remove();
$('div#views_infinite_scroll-ajax-loader').remove();
Drupal.attachBehaviors();
}
}
});
// 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()) {
last = $(items_selector).filter(':last');
handle.autopager('load');
}
else {
break;
}
}
while ($(content_selector).height() > prev_content_height);
}
else {
alert(Drupal.t('Views infinite scroll pager is not compatible with Ajax Views. Please disable "Use Ajax" option.'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment