-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
143 lines (128 loc) · 3.47 KB
/
index.html
File metadata and controls
143 lines (128 loc) · 3.47 KB
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
<!doctype html>
<html>
<head>
<style>
html,body{
margin: 0px;
background-color: black;
height: 100%;
min-height: 100%;
overflow: hidden;
}
.nav{
position: absolute;
display: block;
bottom: 50%;
background-color: whiteSmoke;
border-color: red;
border-radius: 9px;
border-style: outset;
border-width: 5px;
color: black;
padding: 8px;
text-decoration: none
}
.nav:hover{
background-color: silver;
}
.nav:active{
border-style: inset;
}
#container{
width: 100%;
height: 100%;
}
.slide{
width: 100%;
height: 100%;
background-repeat: no-repeat;
background-position: 50% 50%;
background-color: black;
background-size: contain;
position: absolute;
}
#slide1{
background-image: url(https://upload.wikimedia.org/wikipedia/commons/thumb/4/40/PipreolaWhitelyiKeulemans.jpg/179px-PipreolaWhitelyiKeulemans.jpg);
}
#slide2{
background-image: url(https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Gib%C3%A3o_de_couro.jpg/225px-Gib%C3%A3o_de_couro.jpg);
}
#slide3{
background-image: url(https://upload.wikimedia.org/wikipedia/commons/thumb/0/07/Crested_myna%2C_Osaka%2C_Japan.jpg/375px-Crested_myna%2C_Osaka%2C_Japan.jpg);
}
#slide4{
background-image: url(https://upload.wikimedia.org/wikipedia/commons/thumb/f/f9/Egretta_thula_at_Las_Gallinas_Wildlife_Ponds.jpg/231px-Egretta_thula_at_Las_Gallinas_Wildlife_Ponds.jpg);
}
</style>
<script src="jquery-1.11.3.js" type="text/javascript"></script>
<script>
var currentSlide = 1;
var animation = "fade";
//var animation = "slide";
var startUp = function(initSlide, type){
animation = type || "fade";
$(".slide").fadeOut(0);
$("#slide" + initSlide).fadeIn(0);
currentSlide = 1;
$("body").keydown(function(event)
{
var keyCode = event.keyCode;
if(keyCode == 37)
{
goPrev();
}
else if(keyCode == 39)
{
goNext();
}
});
}
var goPrev = function(){
var bw = $("body").width() + "px"
var next = currentSlide - 1
if(next < 1){
next = 4;
}
if(animation === "fade"){
$("#slide" + currentSlide).stop().fadeOut('slow');
$("#slide" + next).stop().fadeIn('slow');
}
else{
//complete this
$("#slide" + currentSlide).stop().animate({left: '100%'}, '200ms', 'linear'); //move current slide right
$("#slide" + next).stop().css('left', '-100%').show(); //Setup Previous Image
$("#slide" + next).animate({left: '0'}, '100ms', 'linear'); //Bring Image to Center
}
currentSlide = next;
}
var goNext = function(){
var next = currentSlide + 1
if(next > 4){
next = 1;
}
var bw = $("body").width() + "px"
if(animation === "fade"){
$("#slide" + currentSlide).stop().fadeOut('slow');
$("#slide" + next).stop().fadeIn('slow');
}
else{
//complete this
$("#slide" + currentSlide).stop().animate({left: '-100%'}, '200ms', 'linear'); //move current slide right
$("#slide" + next).stop().css('left', '100%').show(); //Setup Previous Image
$("#slide" + next).animate({left: '0'}, '100ms', 'linear'); //Bring Image to Center
}
currentSlide = next;
}
</script>
</head>
<body onload='startUp(1,"slide")'>
<div id='container'>
<div class='slide' id='slide1'> </div>
<div class='slide' id='slide2'> </div>
<div class='slide' id='slide3'> </div>
<div class='slide' id='slide4'> </div>
</div>
<a style='left:10px' class='nav' href='javascript:goPrev()'> << Prev </a>
<a style='right:10px' class='nav' href='javascript:goNext()'> Next >> </a>
</body>
</html>