-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnav.html
308 lines (299 loc) · 12 KB
/
nav.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>我的导航</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
*{font-family: 宋体;padding:0;margin:0}
html,body,#app{height: 100%;height:100%;}
body{background: url(http://gdcs.kindpetro.com.cn/dfs/fdfs/file/group3/img/jpg/TTAwLzE4LzUxLw==/CggQ4FoOyrKABkLxAAHKiC163hw111.jpg) no-repeat;background-size: 100% 100%;top:0;left: 0;right: 0;bottom:0;position: fixed}
#app{color:#fff;font-size: x-large;}
.header{height: 5rem;}
.header p{ text-align: center; font-size: 2rem; margin-top: 1rem;}
#content{width: 80%;height: auto;border:1px dashed #cccccc;padding:20px; margin: 0 auto; }
.site div{background-color: rgb(26, 188, 156);border-radius: 50%;text-align: center;cursor: pointer;display: flex; align-items: center;justify-content: center;margin: 0 auto;}
.site{margin-bottom: 30px;}
.site div:hover{transition: 0.3s; transform: scale(1.2) rotate(360deg);background-color: rgb(241, 196, 15)}
.site div:active{transition: 0.3s; transform: scale(0.8) rotate(360deg);}
.pane{width:100%;display: flex;flex-wrap:wrap;}
.ani_previous{animation: 1s previous; animation-fill-mode: forwards;}
.ani_next{animation: 1s next; animation-fill-mode: forwards;}
.footer{text-align: center;margin-top:2rem}
.footer .yuan{background: rgba(255,255,255,.38); border-radius: 50%; display: inline-block; width: 2rem; height: 2rem;cursor: pointer;margin-left: 10px;}
.footer .yuan:hover{transition: 0.5s;transform: scale(1.2);}
.active{background: rgba(36, 95, 169, 0.9) !important ;transition: 0.5s;transform: scale(1.2);}
@keyframes next {
50%{
-webkit-transform: translate(-1000px);
-moz-transform: translate(-1000px);
-ms-transform: translate(-1000px);
-o-transform: translate(-1000px);
transform: translate(-1000px)
}
51%{
opacity: 0;
display: none;
}
52%{
-webkit-transform: translate(1000px);
-moz-transform: translate(1000px);
-ms-transform: translate(1000px);
-o-transform: translate(1000px);
transform: translate(1000px)
}
53%{
display: block;
opacity: 0;
}
100%{
opacity: 1;
-webkit-transform: translate(0px);
-moz-transform: translate(0px);
-ms-transform: translate(0px);
-o-transform: translate(0px);
transform: translate(0px)
}
}
@keyframes previous {
50%{
-webkit-transform: translate(1000px);
-moz-transform: translate(1000px);
-ms-transform: translate(1000px);
-o-transform: translate(1000px);
transform: translate(1000px)
}
51%{
opacity: 0;
display: none;
}
52%{
-webkit-transform: translate(-1000px);
-moz-transform: translate(-1000px);
-ms-transform: translate(-1000px);
-o-transform: translate(-1000px);
transform: translate(-1000px)
}
53%{
display: block;
opacity: 0;
}
100%{
opacity: 1;
-webkit-transform: translate(0px);
-moz-transform: translate(0px);
-ms-transform: translate(0px);
-o-transform: translate(0px);
transform: translate(0px)
}
}
</style>
</head>
<body>
<div id="app">
<div class="header">
<p>我的导航</p>
</div>
<div id="content">
<div class="pane" :class="{ani_previous : aniPrevious , ani_next : aniNext}">
<div v-for="item in siteData" class="site" :style="{width: websiteSize + 'px'}">
<div :style="{width: targetSize + 'px' , height:targetSize + 'px' }" @click="openUrl(item.url)">
{{item.name}}
</div>
</div>
</div>
</div>
<div class="footer">
<span class="yuan" :class="{active : index == item}" v-for="item in totalPage" @click="chosePage(item)">{{item}}</span>
</div>
</div>
</body>
<script src="http://gdcs.kindpetro.com.cn/dfs/fdfs/file/group3/text/js/TTAwLzE4LzUxLw==/CggQ4FoO0Z2AdFN0AAFPnCeHO9s5826.js"></script>
<script>
//====导航个数,长与高各有几个====
var size_x = 5;
var size_y = 3;
var siteData = [
{url : "http://www.baidu.com" , name : "百度"},
{url : "http://mvnrepository.com/" , name : "MAVEN"},
{url : "http://css.doyoe.com/" , name : "CSS"},
{url : "http://blog.xiaojiezhu.com" , name : "博客"},
{url : "https://www.cnblogs.com/" , name : "博客园"},
{url : "https://www.oschina.net/" , name : "开源中国"},
{url : "https://github.com/" , name : "github"},
{url : "https://gitee.com/" , name : "码云"},
{url : "https://www.jiasuu.com/fanqiang-tizi/" , name : "VPN"},
{url : "http://jia.36fy.com/" , name : "加速度"},
{url : "https://translate.google.cn/" , name : "谷歌翻译"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
{url : "https://tinypng.com/" , name : "图片压缩"},
];
var v = new Vue({
el : "#app",
data : {
index : 1, //当前第几页
totalPage : 0,//总共多少页
siteData : [],//导航数据列表
websiteSize: 20,//每个导航的像素
targetSize : 20,
aniPrevious : false,
aniNext: false
},
methods : {
computerSize : function(){
var windowWidth = window.innerWidth;
var contentWidth = windowWidth * 0.8 - 20;
this.websiteSize = contentWidth / size_x;
var tmpSize = this.websiteSize * 0.5;
this.targetSize = computerTargetSize(windowWidth,tmpSize);
},
openUrl : function(url){
window.open(url);
},
computerData : function(){
console.log(this.index);
//计算第几页该有哪些数据
var total = size_x * size_y;
var data = getData(this.index,total);
this.siteData = data;
var totalPage = parseInt(window.siteData.length / total);
if( window.siteData.length % total > 0){
totalPage++;
}
this.totalPage = totalPage;
},
previous : function(){
//上一页
if(this.index > 1){
this.index--;
this.aniPrevious = true;
setTimeout(function(){
v.aniPrevious = false;
},1000)
}
},
next : function(){
//下一页
if(this.index < this.totalPage){
this.index++;
this.aniNext = true;
setTimeout(function(){
v.aniNext = false;
},1000)
}
},
animition : function(){
//切换动画
},
chosePage : function(page){
this.index = page;
}
},
mounted : function(){
this.computerSize();
this.computerData();
},
watch : {
index : function(){
this.computerData();
}
}
});
/**
* 获取分页数据
* @param index 索引
* @param limit 每页几个
*/
function getData(index,limit){
var beginSize = (index -1) * limit;
var array = new Array();
for(var i = 0 ; i < limit ; i ++){
var _index = beginSize + i;
var tmp = window.siteData[_index];
if(typeof(tmp) != 'undefined'){
array.push(tmp);
}else{
break;
}
}
return array;
}
function computerTargetSize(windowWidth,size){
console.log(size)
if(size > 100){
return 100;
}else{
return size;
}
}
window.onresize = function(){
v.computerSize();
};
window.onmousewheel = function(e){
console.log(JSON.stringify(e));
if(e.deltaY > 0){
//向下
if(enableRool()){
v.next();
}
}else{
//向上
if(enableRool()){
v.previous();
}
}
}
var roolTime = new Date().getTime();
function enableRool(){
var now = new Date().getTime();
if(now - roolTime > 1000){
roolTime = now;
return true;
}
return false;
}
</script>
</html>