Created
April 2, 2020 13:00
-
-
Save DariaUshaeva/ae157535629570da09abfe394a860ff3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/js/tygh/infinite_scroll.js b/js/tygh/infinite_scroll.js | |
index 5d752e9..87fc44d 100644 | |
--- a/js/tygh/infinite_scroll.js | |
+++ b/js/tygh/infinite_scroll.js | |
@@ -52,8 +52,11 @@ | |
count = $('#count_scroll_' + scroll_id).val(); | |
begin = parseInt($('#begin_scroll_' + scroll_id).val()) + 1; | |
- var currentHeight = $('[id=' + scroll_id + ']' + '.cm-scroll-content').get(0).scrollHeight; | |
- if($('#' + scroll_id).scrollTop() >= (currentHeight - $('#' + scroll_id).height())){ | |
+ var currentHeight = $('[id=' + scroll_id + ']' + '.cm-scroll-content').get(0).scrollHeight, | |
+ scrollTop = $('[id=' + scroll_id + ']' + '.cm-scroll-content').get(0).scrollTop, | |
+ offsetHeight = $('[id=' + scroll_id + ']' + '.cm-scroll-content').get(0).offsetHeight; | |
+ | |
+ if (scrollTop > 0 && scrollTop >= (currentHeight - offsetHeight)) { | |
loader(); | |
} | |
}, 200); | |
@@ -61,6 +64,20 @@ | |
}); | |
}); | |
+ $.ceEvent('on', 'ce.ajaxdone', function (elms, inline_scripts, params) { | |
+ var tbody = $(this).find('.cm-scroll-data tbody'), | |
+ trCount = tbody.find('tr').length; | |
+ tbodyClientHeight = tbody.get(0).clientHeight; | |
+ tbodyScrollHeight = tbody.get(0).scrollHeight; | |
+ | |
+ if (tbodyClientHeight > 0 && tbodyScrollHeight > 0 && tbodyClientHeight >= tbodyScrollHeight && trCount >= count) { | |
+ count = $('#count_scroll_' + scroll_id).val(); | |
+ begin = parseInt($('#begin_scroll_' + scroll_id).val()) + 1; | |
+ | |
+ loader(); | |
+ } | |
+ }); | |
+ | |
function disabledBlock(elm_start, elm_head_scroll) { | |
$('[id="' + 'elm_head_scroll_' + scroll_id + '_' + elm_head_scroll + '"]').addClass('cm-block-elm-head-scroll'); | |
$('[id="' + 'head_scroll_' + scroll_id + '_' + elm_head_scroll + '"]').addClass('cm-block-head-scroll'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment