-
Notifications
You must be signed in to change notification settings - Fork 0
/
single.html
84 lines (84 loc) · 3.01 KB
/
single.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
<!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/single.css">
</head>
<body>
<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="content">
<div class="up">
<div class="up-left" id="img"></div>
<script id="tpl_img" type="text/template">
<div class="img-big">
<img src="./<%= id %>/a0.jpg" alt="">
</div>
<div class="img-box">
<div class="img-sm"><img src="./<%= id %>/a1.jpg" alt=""></div>
<div class="img-sm"><img src="./<%= id %>/a2.jpg" alt=""></div>
<div class="img-sm"><img src="./<%= id %>/a3.jpg" alt=""></div>
</div>
</script>
<div class="up-right" id="info"></div>
<script id="tpl_info" type="text/template">
<div class="h1"><%= data.h1 %></div>
<div class="des"><%= data.des %></div>
</script>
</div>
<div class="down">
<div class="main">
<div class="label">
产品介绍
</div>
<div class="list" id="list"></div>
<script type="text/template" id="tpl_list">
<% _.each(list, function(item, i){ %>
<div class="item-txt">
<%= item %>
</div>
<div class="item-img">
<img src="./<%= id + '/b' + i %>.jpg">
</div>
<% }); %>
</script>
</div>
</div>
</div>
</body>
<script>
var id = util.get('id');
$('#img').html(_.template($('#tpl_img').html())({id: id}));
$.getJSON('./data.json', function (data) {
$('#menu').html(_.template($('#tpl_menu').html())({list: data[0]}));
$('.menu-item').eq(id-1).addClass('on');
});
$.getJSON(id + '/data.json', function (data) {
$('#info').html(_.template($('#tpl_info').html())({data: data.info}));
$('#list').html(_.template($('#tpl_list').html())({list: data.list, id: id}));
document.title = data.title;
});
</script>
</html>