Попробуйте создать элемент, например кнопку, которая будет загружать скрипт при нажатии на него, а затем использовать этот код для запуска кнопки при прокрутке вниз (работает на всех устройствах):
var CheckIfScrollBottom = debouncer(function() {
if (getDocHeight() == getScrollXY()[1] + window.innerHeight) {
$('your button id or class').trigger('click');
}
});
Ваш Аякс будет:
<script>
$(document).ready(function(){
var loadLogs = 0;
$.ajax({
type: 'GET',
url: 'inc/loadLogs.php',
data:{
'offset': 0,
'limit': 1
}
,
success: function(data){
$('#showAuditLogs').append(data);
loadLogs += 1;
}
}
);
var CheckIfScrollBottom = debouncer(function() {
if (getDocHeight() == getScrollXY()[1] + window.innerHeight) {
$.ajax({
type: 'GET',
url: 'inc/loadLogs.php',
data:{
'offset': loadLogs,
'limit': 1
}
,
success: function(data){
$('#showAuditLogs').append(data);
loadLogs += 1;
}
}
);
}
}
);
}
);
document.addEventListener('scroll', CheckIfScrollBottom);
function debouncer(a, b, c) {
var d;
return function() {
var e = this,
f = arguments,
g = function() {
d = null, c || a.apply(e, f)
}
,
h = c && !d;
clearTimeout(d), d = setTimeout(g, b), h && a.apply(e, f)
}
}
function getScrollXY() {
var a = 0,
b = 0;
return "number" == typeof window.pageYOffset ? (b = window.pageYOffset, a = window.pageXOffset) : document.body && (document.body.scrollLeft || document.body.scrollTop) ? (b = document.body.scrollTop, a = document.body.scrollLeft) : document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop) && (b = document.documentElement.scrollTop, a = document.documentElement.scrollLeft), [a, b]
}
function getDocHeight() {
var a = document;
return Math.max(a.body.scrollHeight, a.documentElement.scrollHeight, a.body.offsetHeight, a.documentElement.offsetHeight, a.body.clientHeight, a.documentElement.clientHeight)
}
</script>