当我到达滚动的末尾或元素的底部时,iScroll lite会找到 [英] iScroll lite find when I have reached the end of the scroll or bottom of the element

查看:272
本文介绍了当我到达滚动的末尾或元素的底部时,iScroll lite会找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的我一直在搜索并寻找答案,但还没找到我正在寻找的一般区域。不是非常熟悉iScroll(这个项目的前开发人员加入了它,我现在正在接管它)。我一直试图弄清楚从哪里开始使用iScroll。

Ok I've been searching and searching for an answer, but have yet to find one in the general area I am looking for. Not being supremely familiar with iScroll (a former developer on this project added it in, and I am now taking it over). I have been trying to figure out where to begin with iScroll.

现在所有的内容似乎都相应地向上和向下滚动。但是我想为已开发的整个应用程序添加一些功能,例如获取旧数据并将其附加到当时列出的最新数据中。无限卷轴。

Right now all seems to work accordingly as far as scrolling up and down. But I want to add some functionality to the overall app thats been developed, such as getting older data and appending it to the more recent data thats listed at that time. An infinite scroll.

通过ajax拉入数据,并使用它将其附加到并刷新iScroll长度并不是问题(我认为,目前在至少)。我的问题是找到达到底部的那一刻,然后解雇我将要获取所述数据并追加它的功能。

Pulling in the data via ajax, and working with it to append it to and refresh iScroll length isn't so much the issue (I think, well for the moment at the least). What is my issue is finding that moment when the bottom is reached and firing off the function I will make to get said data and append it.

我找不到任何任何地方的例子所以我希望有人在这里可以给我一些想法

I can't find any examples anywhere so I am hoping someone here can throw me some ideas

推荐答案

因为这个问题很老了。此解决方案适用于将来的任何参考。

Since this question is pretty old. This solution is for any future references.

使用 iScroll v4.2.5:

var scroll = new iScroll('scroll-wrapper');
scroll.options.onScrollEnd = function(){
    if(Math.abs(this.maxScrollY) - Math.abs(this.y) < 10){
        // RUN CODE if scroll is 10px from the bottom.
    }
};

这篇关于当我到达滚动的末尾或元素的底部时,iScroll lite会找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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