1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-09 23:00:57 -05:00

small code cleanups

This commit is contained in:
RaidMax
2019-07-19 14:54:39 -05:00
parent 4a013a98f8
commit 486973a2bc
8 changed files with 44 additions and 45 deletions

View File

@ -1,6 +1,21 @@
let offset = 15;
let isLoading = false;
function ScrollHandler(e) {
//throttle event:
hasScrollBar = true;
clearTimeout(_throttleTimer);
_throttleTimer = setTimeout(function () {
//do work
if ($window.scrollTop() + $window.height() > $document.height() - 100) {
loadMorePenalties();
}
}, _throttleDelay);
}
function loadMorePenalties() {
if (isLoading) {
return false;
@ -34,7 +49,7 @@ if ($('#penalty_table').length === 1) {
https://stackoverflow.com/questions/19731730/jquery-js-detect-users-scroll-attempt-without-any-window-overflow-to-scroll
*/
$('html').bind('mousewheel DOMMouseScroll', function (e) {
var delta = (e.originalEvent.wheelDelta || -e.originalEvent.detail);
var delta = e.originalEvent.wheelDelta || -e.originalEvent.detail;
if (delta < 0 && !hasScrollBar) {
loadMorePenalties();
@ -59,18 +74,4 @@ if ($('#penalty_table').length === 1) {
loadMorePenalties();
});
});
function ScrollHandler(e) {
//throttle event:
hasScrollBar = true;
clearTimeout(_throttleTimer);
_throttleTimer = setTimeout(function () {
//do work
if ($window.scrollTop() + $window.height() > $document.height() - 100) {
loadMorePenalties();
}
}, _throttleDelay);
}
}