移动端上拉加载,下拉刷新实现方案?
上拉加载

使用场景
用于长列表,需要通过上拉加载提高性能
实现步骤
-
滚动事件监听
-
怎么判断触底
-
回调触发列表加载更多
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>上拉加载</title>
<style>
#content {
width: 300px;
height: 80vh;
overflow-y: auto;
margin: 0 auto;
/* border: 1px solid #ccc; */
}
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
}
.item {
padding: 20px;
border-bottom: 1px solid #ccc;
}
.loading {
text-align: center;
padding: 20px;
display: none;
color: red;
}
</style>
</head>
<body>
<div id="content">
<div id="items"></div>
<div id="loading" class="loading">加载中...</div>
947




被折叠的 条评论
为什么被折叠?



