I implementing infinite scroll in my web app using angularjs. I found this useful directive on net Infinite Scroll, but the problem is this can only be implemented inside div not in the scroll bar body:
我使用angularjs在我的网络应用程序中实现无限滚动。我在net Infinite Scroll上找到了这个有用的指令,但问题是这只能在div内而不是在滚动条体中实现:
app.directive('infinityscroll', function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.bind('scroll', function () {
if ((element[0].scrollTop + element[0].offsetHeight) == element[0].scrollHeight) {
//scroll reach to end
scope.$apply(attrs.infinityscroll)
}
});
}
}
});
Here is my html codes:
这是我的html代码:
<div infinityscroll="NextPage()" style="height:700px; overflow:auto;" >
<div ng-repeat="item in listItems">
<img ng-src="{{item.picture}}" alt="broken" style="">
</div>
</div>
when i remove the inline css it won't work.so how can i change the infinite scroll in the body instead of div?
当我删除内联css它将无法工作。所以我怎么能改变身体中的无限滚动而不是div?
1 个解决方案
#1
0
Try this: <body infinityscroll="NextPage()" style="height: 1000px; overflow:auto;">
and remove infinitescroll initialization from your div.
试试这个:并从你的div中删除infinitescroll初始化。
You might need to adjust height a bit, based on your screen-size. Hope this solves your issue.. :)
您可能需要根据屏幕大小调整高度。希望这能解决你的问题.. :)
#1
0
Try this: <body infinityscroll="NextPage()" style="height: 1000px; overflow:auto;">
and remove infinitescroll initialization from your div.
试试这个:并从你的div中删除infinitescroll初始化。
You might need to adjust height a bit, based on your screen-size. Hope this solves your issue.. :)
您可能需要根据屏幕大小调整高度。希望这能解决你的问题.. :)