-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo-Pager.html
98 lines (85 loc) · 2.53 KB
/
demo-Pager.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pager</title>
<link href="demo.css" rel="stylesheet">
<script src="jquery.js"></script>
<link href="dist/css/H.min.css" rel="stylesheet" type="text/css">
<script src="dist/js/H.min.js"></script>
</head>
<body>
<div class="container">
<h2>Pager</h2>
<ul>
<li>使用方法请看源代码及注释</li>
</ul>
<div style="height: 50px"></div>
<h2>Demo</h2>
<div id="J-page-wrap-t"></div>
<br>
<div id="J-page-wrap-b"></div>
<br><br><br>
<div id="J-page-wrap-t2"></div>
<br>
<div id="J-page-wrap-b2"></div>
<script type="text/html" id="J-page-tpl-t">
<div class="ui-pager">
<span class="ui-pager-txt">
共<%= total %>条数据 <em><%= apg %></em> / <%= pgc %>
</span>
<% $.each(els, function (i, item) { %>
<a class="J-page-to <%= item.cls %>" data-pg="<%= item.pg %>"><%= item.name %></a>
<% }) %>
</div>
</script>
<script type="text/html" id="J-page-tpl-b">
<div class="ui-pager">
<% $.each(els, function (i, item) { %>
<a class="J-page-to <%= item.cls %>" data-pg="<%= item.pg %>"><%= item.name %></a>
<% }); %>
</div>
跳转到<input type="text" class="ui-pager-input J-page-go-input" value="<%= apg %>">页
<button class="ui-pager-btn J-page-go-btn" data-cur-page="<%= apg %>" data-max-page="<%= pgc %>">GO</button>
</script>
</div>
<script type="text/javascript">
var pagerA = new H.Pager({
tplT : $('#J-page-tpl-t').html(),
tplB : $('#J-page-tpl-b').html(),
wrapT : $('#J-page-wrap-t'),
wrapB : $('#J-page-wrap-b'),
goToPageFunc : function (pageNum) {
pagerA.render({
pg: pageNum,
total: 120,
ps: 10
});
}
});
pagerA.render({
pg: 5,
total: 120,
ps: 10
});
var pagerB = new H.Pager({
tplT : $('#J-page-tpl-t').html(),
tplB : $('#J-page-tpl-b').html(),
wrapT : $('#J-page-wrap-t2'),
wrapB : $('#J-page-wrap-b2'),
goToPageFunc : function (pageNum) {
pagerB.render({
pg: pageNum,
total: 180,
ps: 10
});
}
});
pagerB.render({
pg: 8,
total: 180,
ps: 10
});
</script>
</body>
</html>