-
Notifications
You must be signed in to change notification settings - Fork 0
/
animals.html
152 lines (132 loc) · 3.63 KB
/
animals.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
<!DOCTYPE html>
<html>
<head>
<style>
body{
background-color: black;
}
* {
box-sizing: border-box;
}
h1 {
text-align: center;
}
.outer-grid {
display: flex;
flex-wrap: wrap;
padding: 0 4px;
}
.inner-grid {
flex: 25%;
max-width: 50%;
padding: 0 4px;
}
.inner-grid img {
margin-top: 8px;
width: 100%;
padding: 10px;
}
@media screen and (max-width: 800px) {
.inner-grid {
flex: 50%;
max-width: 50%;
}
}
@media screen and (max-width: 600px) {
.inner-grid {
flex: 100%;
max-width: 100%;
}
}
<style type="text/css">
.fade {
margin: 50px;
padding: 50px;
background-color: lightgreen;
opacity: 1;
}
a{
text-decoration: none;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(window).on("load", function() {
$(window).scroll(function() {
var windowBottom = $(this).scrollTop() + $(this).innerHeight();
$(".fade").each(function() {
/* Check the location of each desired element */
var objectBottom = $(this).offset().top + $(this).outerHeight();
/* If the element is completely within bounds of the window, fade it in */
if (objectBottom < windowBottom) { //object comes into view (scrolling down)
if ($(this).css("opacity") == 0) {
$(this).fadeTo(500, 1);
}
} else { //object goes out of view (scrolling up)
if ($(this).css("opacity") == 1) {
$(this).fadeTo(500, 0);
}
}
});
}).scroll(); //invoke scroll-handler on page-load
});
</script>
</style>
</head>
<body>
<h1 style="color: white;">EXTINT LAND ANIMALS</h1>
<div class="outer-grid">
<div class="inner-grid">
<div class="fade">
<a href="mammoth.html"><img src="mammoth.jpg"/></a>
<figcaption style="color: white; text-align: center;size: 50px;">MAMMOTH</figcaption>
</div></a>
<div class="fade">
<a href="entelodont.html"><img src="entelodont.jpg"/>
<figcaption style="color: white; text-align: center;size: 50px;">ENTELODONT</figcaption>
</div>
<div class="fade">
<a href="giantelk.html"><img src="elk.jpg"/>
<figcaption style="color: white; text-align: center;size: 50px;">GIANT-ELK</figcaption>
</div>
<div class="fade">
<a href="hyaenodon.html"><img src="hyaenodon.jpg"/>
<figcaption style="color: white; text-align: center;size: 50px;">HYAENODON</figcaption>
</div>
</div>
<div class="inner-grid">
<div class="fade">
<a href="deodicurus.html"><img src="deodicurus.jpg"/>
<figcaption style="color: white; text-align: center;size: 50px;">DEODICURUS</figcaption>
</div></a>
<div class="fade">
<a href="andrewsarchus.html"><img src="Andrewsarchus.jpg"/>
<figcaption style="color: white; text-align: center;size: 50px;">Andrewsarchus</figcaption>
</div>
<div class="fade">
<a href="gaint sloth.html"><img src="gaint sloth.jpg"/>
<figcaption style="color: white; text-align: center;size: 50px;">GAINT GROUND SLOTH</figcaption>
</div>
<div class="fade">
<a href="wollyrhino.html"><img src="woollyrhino.jpg"/>
<figcaption style="color: white; text-align: center;size: 50px;">WOLLY-RHINO</figcaption>
</div></a>
deodicurus
</div>
<div class="inner-grid">
<div class="fade">
<a href="sabertooth.html"> <img src="sabertooth.jpg"/>
<figcaption style="color: white; text-align: center;size: 50px;">SABERTOOTH</figcaption>
</div></a>
<div class="fade">
<a href="capsiantiger.html"> <img src="capsiantiger.jpg"/>
<figcaption style="color: white; text-align: center;size: 50px;">CAPSIAN TIGER</figcaption>
</div></a>
<div class="fade">
<a href="paraceratherium.html"><img src="paraceratherium.jpg"/>
<figcaption style="color: white; text-align: center;size: 50px;">PARACERATHERIUM</figcaption>
</div>
</div>
</div>
</body>
</html>