forked from oozonomomoko/blog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
picPage.html
110 lines (104 loc) · 3.35 KB
/
picPage.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
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
#macy-container div {
overflow: hidden;
}
#macy-container div img {
width: 100%;
}
</style>
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/macy.js"></script>
<script>
var masonry;
var id;
var href = window.location.href;
var end = href.indexOf("#");
var start = href.indexOf("?");
if (-1 != start) {
if (-1 != end) {
href = href.substring(start + 1, end);
} else {
href = href.substring(start + 1)
}
}
var plist = href.split("&");
for (var p in plist) {
if (plist[p].split("=")[0] == "d") {
id = plist[p].split("=")[1];
break;
}
}
if (!id) {
var date = new Date();
var year = date.getFullYear();
var mon = date.getMonth() + 1;
mon = mon < 10 ? "0" + mon : mon;
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
id = year + mon + day;
}
$.ajax({
type: "GET",
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
url: "/nogizaka/message/getBlogPic.do?day=" + id,
dataType: "json",
success: function (pics) {
var inner = "";
if (pics && pics.length != 0) {
for (var s in pics) {
if (pics[s].indexOf(".gif") == -1) {
inner += "<div><img src='blog/" + id + "/" + pics[s] + "'/></div>";
}
}
}
document.getElementById("macy-container").innerHTML = inner;
masonry = new Macy({
container: '#macy-container', // 图像列表容器id
trueOrder: false,
waitForImages: true,
useOwnImageLoader: false,
debug: false,
//设计间距
margin: {
x: 10,
y: 10
},
//设置列数
columns: 6,
//定义不同分辨率(1200,940,520,400这些是分辨率)
breakAt: {
1200: {
columns: 5
},
940: {
columns: 4
},
520: {
columns: 3
},
400: {
columns: 2
}
}
});
}
});
window.onresize = function () {
masonry.reInit()
};
</script>
<title>博客图</title>
</head>
<body>
<section class="section">
<div class="container">
<div id="macy-container">
</div>
</div>
</section>
</body>
</html>