-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
38 lines (36 loc) · 1.17 KB
/
index.html
File metadata and controls
38 lines (36 loc) · 1.17 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>Title</title>
<script src="js/lib/zepto.min.js"></script>
<script src="js/lib/zepto.bindJSON.min.js"></script>
<link href="css/css.css" rel="stylesheet" />
<style>
</style>
</head>
<body>
<ul id="dataObj" class="hide" data-loadInfo="数据加载中……" data-jsonUrl="js/json/data.json">
<li data-href="detail.html?id={placeID}">
<div>
<div class="hd">{placeName}</div>
<div class="hd">{placeName}</div>
<div class="bd">活动时间:{activitytime}</div>
</div>
</li>
</ul>
<script>
$("#dataObj").bindJSON("list", {isPage: true, pageSize:1},
//回调函数示例,
function () {
//偶数行添加变红样式
$("#dataObj>li:nth-child(even)").addClass("red");
//li元素整体添加链接
$("#dataObj>li").on("click", function () {
location.href = $(this).attr("data-href");
})
})
</script>
</body>
</html>