angularjs 在容器中无限滚动 [英] angularjs infinite scroll in a container

查看:35
本文介绍了angularjs 在容器中无限滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 angularjs 无限滚动似乎只有当滚动相对于浏览器窗口时才有效.

I'm trying to use angularjs infinite scroll It seems to work only if the scroll is relative to the browser window.

我想在内部 DIV 中进行无限滚动,即我有一个带有通用包装器的页面和一个用于显示实际内容的内部 div.

I would like to do infinite scroll in an inner DIV, i.e. I have a page with a generic wrapper and an inner div for displaying the actual content.

包装页面被设置为经过整个窗口,因此它永远不能滚动.但是包含内容的内部 div 有自己的滚动条.

The wrapper page is set to elapse the entire window, thus it is never scrollable. but the inner div that contain content, has its own scroll bar.

如何使无限滚动相对于内部内容 div 滚动条起作用?

How to I get the infinite scroll to work relative to the inner content div scrollbar?

推荐答案

如果有人搜索相同的内容并来到这里 - 这里有有用的链接:

In case anyone searches the same and comes here - here are usefull links:

https://github.com/BinaryMuse/ngInfiniteScroll/pull/7(拉取请求和讨论)

https://github.com/hlsolutions/ngInfiniteScroll/tree/scroll-on-any-lement(具有必要功能的 fork)

https://github.com/hlsolutions/ngInfiniteScroll/tree/scroll-on-any-lement (fork with neccessary functionality)

https://raw.github.com/hlsolutions/ngInfiniteScroll/scroll-on-any-lement/src/infinite-scroll.coffee(来源本身)

你可以这样使用(例子是在haml中):

You can use it this way (example is in haml):

.div-with-overflow
  %ul{data: {'infinite-scroll' => "getItems()", 'infinite-scroll-disabled' => 'cannotGetItems()', 'infinite-scroll-parent' => 'true'}}

提供 'infinite-scroll-parent' =>'true' 将使父元素用于计算而不是窗口.

Providing an 'infinite-scroll-parent' => 'true' will make parent element to be used for calculations instead of a window.

这篇关于angularjs 在容器中无限滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆