nested_horizonscroll.html
3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!--
作者:dailc
时间:2017-09-05
描述: 横向滑动嵌套
-->
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>horizontal scroll</title>
<link rel="stylesheet" href="../../dist/debug/minirefresh.css" />
<link rel="stylesheet" href="../common/common.css" />
<style>
.native-scroll {
padding: 15px;
overflow: hidden;
border-bottom: 1px solid #c8c7cc;
}
.scroll__list {
position: relative;
-webkit-overflow-scrolling: touch;
font-size: 0;
white-space: nowrap;
overflow-x: auto;
}
.scroll__item {
display: inline-flex;
align-items: center;
justify-content: center;
width: 120px;
height: 90px;
margin: 0 7.5px;
font-size: 15px;
background-color: #ccc;
}
</style>
</head>
<body>
<nav class="navbar-header">
<a class="nav-btn-left" href="../index.html">dashboard</a>
横向滑动嵌套
</nav>
<div class="content">
<div id="minirefresh" class="minirefresh-wrap">
<div class="minirefresh-scroll">
<div class="native-scroll">
<div class="scroll__list">
<div class="scroll__item">item_1</div>
<div class="scroll__item">item_2</div>
<div class="scroll__item">item_3</div>
<div class="scroll__item">item_4</div>
<div class="scroll__item">item_5</div>
<div class="scroll__item">item_6</div>
<div class="scroll__item">item_7</div>
<div class="scroll__item">item_8</div>
<div class="scroll__item">item_9</div>
</div>
</div>
<ul class="data-list" id="listdata">
</ul>
</div>
</div>
</div>
<script type="text/javascript" src="../../dist/debug/minirefresh.js"></script>
<script type="text/javascript" src="../common/common.js"></script>
<script>
var appendTestData = Common.appendTestData,
// 记录一个最新
maxDataSize = 30,
listDom = document.querySelector('#listdata'),
requestDelayTime = 600;
var miniRefresh = new MiniRefresh({
container: '#minirefresh',
// 设置为 false 原生滚动条可以滑动
isLockX: false,
down: {
callback: function() {
setTimeout(function() {
// 每次下拉刷新后,上拉的状态会被自动重置
appendTestData(listDom, 10, true);
miniRefresh.endDownLoading(true);
}, requestDelayTime);
}
},
up: {
isAuto: true,
callback: function() {
setTimeout(function() {
appendTestData(listDom, 4);
miniRefresh.endUpLoading(listDom.children.length >= maxDataSize ? true : false);
}, requestDelayTime);
}
}
});
</script>
</body>
</html>