내 Scroll 이벤트가 여기에서 두 번 호출되는 이유는 무엇입니까?
InfiniteScrollFactory : 나는 한 번 마우스를 아래로 스크롤 할 때
const scrollingSocial = (e) => {
console.log('scrollingSocial');
// e.stopPropagation();
const reachedBottom =() => socialCol.scrollHeight - socialCol.scrollTop === socialCol.offsetHeight;
const loadMoreItems =() => {
console.log('[ Fire Once ] loadMoreItems...');
$rootScope.$emit("socialmedia.stream.load");
};
if (reachedBottom()) loadMoreItems();
};
const wireSocialScroll = (list) => {
console.log('wireSocialScroll called!');
if (notEmpty(list)) {
socialCol.addEventListener('scroll', scrollingSocial);
}
};
const attachScrollListener = (location, col, list) => {
console.log('attachScrollListener');
console.log(' location', location);
switch (location) {
// case 'tagsPanel' : tagsCol = col; wireTagsScroll(list); break;
// case 'feedPanel' : feedCol = col; wireFeedScroll(list); break;
case 'socialMedia' : socialCol = col; wireSocialScroll(list); break;
}
};
내 scrollingSocial
함수를 한 번 호출됩니다. 마침내 내 loadMoreItems
기능을 트리거하려면 약 45 개의 '스크롤'이 필요합니다. 그러나 두 번 호출됩니다. 46 번째 스크롤을하지는 않았지만 46 번째 스크롤을 봅니다.
socialMediaDirective :
const getColHeight = (tags) => {
if (notEmpty(tags)) InfiniteScrollFactory.attachScrollListener('socialMedia', socialCol, tags);
};
아 감사합니다! 나는 수년 전에이 같은 질문을 해본 적이있다. 그 당시의 수정은 '타임 아웃'이었지만, 타임 아웃은 작동하지 않았다. 그러나이 검사는 수행합니다! –