forked from beiyuu/Github-Pages-Example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·86 lines (82 loc) · 3.1 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
84
85
86
---
layout: default
---
<script type="text/javascript">
BYB.images = [
'http://ww1.sinaimg.cn/large/8b8af2c8gw1do3ek44ojej.jpg'
,'http://ww1.sinaimg.cn/large/8b8af2c8gw1do3eq6pla4j.jpg'
,'http://ww1.sinaimg.cn/large/a74e55b4jw1dv23n1n9zaj.jpg'
,'http://ww3.sinaimg.cn/large/a74e55b4jw1dv23op0j6qj.jpg'
];
BYB.img = new Image();
BYB.img.src = BYB.images[parseInt(Math.random()*10,10)%4];
BYB.img.id = 'bgImage'
</script>
<div id="mycard" class="clearfix">
<div class="name">
<a href="/" class="link-icon">BeiYuu</a>
</div>
<div class="blog">
<a href="/blog" class="link-icon"><span></span></a>
<a href="/blog" class="link-info hide"><span>Blog</span></a>
</div>
<div class="project">
<a href="/project" class="link-icon"><span></span></a>
<a href="/project" class="link-info hide"><span>Project</span></a>
</div>
<div class="wiki">
<a href="/wiki" class="link-icon"><span></span></a>
<a href="/wiki" class="link-info hide"><span>Wiki</span></a>
</div>
<div class="about">
<a href="/about" class="link-icon"><span></span></a>
<a href="/about" class="link-info hide"><span>About Me</span></a>
</div>
<div class="rss">
<a href="{{ site.feed }}" class="link-icon"><span></span></a>
<a href="{{ site.feed }}" class="link-info hide"><span>Rss</span></a>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var imgWidth,imgHeight,winWidth,winHeight;
var imgComplete = function(){
imgHeight = BYB.img.height;
imgWidth = BYB.img.width;
resizeWindow();
//$('#mycard').css({'opacity':0.8});
$('body').css('background','none');
$(BYB.img).animate({opacity:'toggle'},500);
};
var resizeWindow = function(){
var _width,_height;
winHeight = $(document).height();
winWidth = $(document).width();
_height = imgHeight*winWidth/imgWidth;
_width = imgWidth*winHeight/imgHeight;
if(_height < winHeight){
$('#bgImage').css({'height':winHeight,'width':_width,'left':-(_width-winWidth)*0.5});
}else{
$('#bgImage').css({'width':winWidth,'height':_height,'left':0});
}
};
$(BYB.img).css({'position':'fixed','top':'0','z-index':'-2','display':'none'});
$('body').append(BYB.img);
if(BYB.img.complete){
imgComplete()
}else{
BYB.img.onload = imgComplete;
}
$(window).on('resize',resizeWindow);
$('#mycard div').on('mouseenter',function(){
if(!$(this).hasClass('name')){
$(this).addClass('link-hover');
$(this).children('.link-info').removeClass('hide').animate({height:'23px'},'fast');
}
});
$('#mycard div').on('mouseleave',function(){
$(this).removeClass('link-hover');
$(this).children('.link-info').stop().animate({height:'0'});
});
})
</script>