0
가 나는 각도 무한 스크롤 모바일 기기에서 작동하지 않는 문제에 직면 한 - 샤오 미 Redmi 주 4와 삼성 갤럭시에서 테스트 4.ngInfiniteScroll (무한 스크롤)이 휴대 기기에서 작동하지 않는 이유는 무엇입니까?
내 코드는 IOS PC와 에 제대로 작동 기기 :
문제는 휴대 기기에서만 재생됩니다.
누군가 같은 문제에 직면했을 수 있습니까? 나에게 뭔가 제안 해 줄 수있어?
$scope.loadNews = function() {
if ($scope.position > $scope.allNews.length) return;
if ($scope.allNews.length > $scope.news.length) {
var partOfNews = $scope.getPartOfEntities($scope.newsPosition, $scope.scrollNewsCount, 0);
for (var i = 0; i < partOfNews.length; i++) {
$scope.news.push(partOfNews[i]);
}
}
};
<div ng-hide="showSpinner">
<div infinite-scroll='loadNews()' infinite-scroll-distance='0.5'>
<hr>
<news data="news"></news>
</div>
</div>
handler = function() {
var elementBottom, remaining, shouldScroll, windowBottom;
windowBottom = $window.height() + $window.scrollTop();
elementBottom = elem.offset().top + elem.height();
remaining = elementBottom - windowBottom;
shouldScroll = remaining <= $window.height() * scrollDistance;
if (shouldScroll && scrollEnabled) {
if ($rootScope.$$phase) {
return scope.$eval(attrs.infiniteScroll);
} else {
return scope.$apply(attrs.infiniteScroll);
}
} else if (shouldScroll) {
return checkWhenEnabled = true;
}
};
var applied = false;
var touchmover = function() {
if (! applied) {
applied = true;
$window.on('touchend', handler);
}
};
$window.on('touchmove', handler);
scope.$on('$destroy', function() {
$window.off('touchend', handler);
applied = false;
return $window.off('touchmove', touchmover);
});
스크롤을 기반으로 간단한 코드를 사용할 수 있습니다 . 나는이 문제에 대한 대안적인 접근법을 찾으려고 노력하지 않고있다. –