Comments (2)
具体指的是哪一个组件?
from frozenjs.
因为没有固定的结构,这种页面拉到底部继续加载的交互现在一般没有用组件,就是在onscroll事件中判断滚动条高度和页面高度,下面的代码可以参考下:
function onScroll() {
if (base.hasMask() || !hasMore) {
return;
}
var viewHeight = $(window).height();//浏览器可视区域高度
var scrollHeight = $(window).scrollTop();//已滚动高度
var docHeight = $(document).height();//页面文档高度
var loadingHeight = $("#loading").height();
if (lastDocHeight == docHeight) {//避免页面内容改变前多次触发滚动条事件导致重复加载内容
return false;
}
if (viewHeight + scrollHeight >= docHeight - loadingHeight / 2) {
lastDocHeight = docHeight;
// to do something
} else if (viewHeight + scrollHeight >= docHeight - loadingHeight / 2 - 100) {
var date = new Date();
var now = date.getTime();
if (window.lastSetScrollTime == undefined || now - window.lastSetScrollTime >= 200) {
document.body.scrollTop = scrollHeight;
window.lastSetScrollTime = now;
}
}
}
$(window).scroll(function (event) {
onScroll();
});
from frozenjs.
Related Issues (19)
- 用户建议 HOT 15
- 与angularjs不能配合使用 HOT 6
- 可以增加下拉刷新上拉加载吗 HOT 1
- 2个图片轮播在同一页面中产生冲突不可用:) HOT 3
- 模块化加载(seajs),出现undefined HOT 1
- 1.0.0版本发布
- tab组件默认索引不是第一个时的临时方案 HOT 1
- 缺少action sheet弹出菜单 HOT 1
- 你好,请问下你们基于zepto开发,zepto有特定版本吗?还是最新的zepto1.1.6也支持?然后,你们的ui组件,怎么连日历控件都木有?谢谢。 HOT 2
- tab某个页的内容动态加载或者被操作后,不能正常显示 HOT 2
- dialog的allowScroll参数无效
- tab内容中,zepto注册的longTap失效 HOT 5
- dialog回调不会被调用 HOT 2
- 出现$.tips is not a function 的报错 HOT 2
- tap事件绑定document使点击页面input不进入编辑状态
- 1.0.0后续计划 HOT 2
- Scroller源码地址不对 HOT 8
- 公布的frozen-debug.js和http://i.gtimg.cn/vipstyle/frozenjs/1.0.0/frozen.js?_bid=304 不一样 HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from frozenjs.