Skip to content

Instantly share code, notes, and snippets.

@Sentinel-7
Forked from ig0r74/mfilter2_more_button.js
Last active August 4, 2020 10:31
Show Gist options
  • Save Sentinel-7/44e4d804cbd31bfe9cf1f6b66cc03a01 to your computer and use it in GitHub Desktop.
Save Sentinel-7/44e4d804cbd31bfe9cf1f6b66cc03a01 to your computer and use it in GitHub Desktop.
MODX mFilter2 одновременное использование стандартной пагинации и подгрузки кнопкой
$('.btn_more_custom').click(function() {
var href = $('.mse2_pagination .page-item.active').next('.page-item').find('.page-link').attr('href');
if (typeof href !== "undefined") {
mSearch2.addPage();
}
});
$(document).on('mse2_load', function(e, data) {
if (typeof $('.mse2_pagination .page-item.active').next('.page-item').next('.page-item').find('.page-link').attr('href') === "undefined") {
$('.btn_more_custom').hide();
} else {
$('.btn_more_custom').show();
}
});
// добавить кнопку под результатами
<button class="btn btn-default btn_more_custom">Загрузить еще</button>
<div class="mse2_pagination">
{'page.nav' | placeholder}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment