-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
83 lines (83 loc) · 2.95 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>首页</title>
<script src="./js/jquery.min.js"></script>
<script src="./js/underscore-min.js"></script>
<script src="./js/util.js"></script>
<link rel="stylesheet" href="./css/style.css">
<link rel="stylesheet" href="./css/index.css">
</head>
<body>
<div class="left">
<div class="header">
<div class="logo">
<a href="./">
<img src="./images/logo.png" alt="">
</a>
</div>
<div class="menu" id="menu"></div>
<script type="text/template" id="tpl_menu">
<% _.each(list, function(item){ %>
<a href="single.html?id=<%= item.id %>">
<div class="menu-item">
<%= item.title %>
</div>
</a>
<% }); %>
</script>
</div>
<div class="pro" id="list"></div>
<script type="text/template" id="tpl_list">
<% _.each(list, function(item, i){ %>
<a href="single.html?id=<%= item.id %>">
<div class="pro-item">
<img src="images/<%= i %>.jpg" alt="">
<div class="title"><%= item.title %></div>
<div class="des"><%= item.des %></div>
<div class="mask"></div>
</div>
</a>
<% }); %>
</script>
</div>
<div class="left">
<div class="diy-menu" id="menu2"></div>
<script type="text/template" id="tpl_menu2">
<span class="red">•</span>
<% _.each(list, function(item){ %>
<a href="diy.html?id=<%= item.id %>">
<div class="menu-item">
<%= item.title %>
</div>
</a>
<% }); %>
</script>
<div class="diy-list" id="list2"></div>
<script type="text/template" id="tpl_list2">
<% _.each(list, function(item, i){ %>
<a href="diy.html?id=<%= item.id %>">
<div class="diy-item">
<img src="./images/x<%= i %>.jpg" alt="">
<div class="diy-h1"><%= (item.id>9 ? '':'0') + item.id %> <%= item.title %></div>
<% _.each(item.des, function(item){ %>
<p><%= item %></p>
<% }); %>
</div>
</a>
<% }); %>
</script>
</div>
</body>
<script>
$.getJSON('./data.json', function (data) {
$('#menu').html(_.template($('#tpl_menu').html())({list: data[0]}));
$('#list').html(_.template($('#tpl_list').html())({list: data[0]}));
$('#menu2').html(_.template($('#tpl_menu2').html())({list: data[1]}));
$('#list2').html(_.template($('#tpl_list2').html())({list: data[1]}));
});
</script>
</html>