-
Notifications
You must be signed in to change notification settings - Fork 0
/
random_image.html
97 lines (97 loc) · 2.43 KB
/
random_image.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
<head>
<link rel="stylesheet" href="main.css" />
<link rel="stylesheet" href="random_image.css" />
<title>Random Background | JavaScript stuff</title>
<script src="main.js"></script>
</head>
<a
style="padding: 5px; background: rgba(0, 0, 0, 0.5)"
id="back"
href="index.html"
>⇦ Back</a
>
<body>
<div
class="text-container"
style="
margin: auto auto;
max-height: 600px;
max-width: 500px;
background: rgba(0, 0, 0, 0.35);
color: white;
border-radius: 10px;
border: 5px solid rgba(0, 0, 0, 0.2);
"
>
<h1>Random background image generator!</h1>
<p>
Click the button to get a new image! (Please note that you have to wait a
few seconds each time, or it won't work)
</p>
<button onclick="window.location.reload(true)">Get a new image!</button>
</div>
</body>
<div class="se-pre-con"></div>
<style>
.no-js #loader {
display: none;
}
.js #loader {
display: block;
position: absolute;
left: 100px;
top: 0;
}
.se-pre-con {
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 9999;
background: url("load.svg") center no-repeat black;
}
</style>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.js"></script>
<script>
//paste this code under the head tag or in a separate js file.
// Wait for window load
$(window).load(function () {
// Animate loader off screen
$(".se-pre-con").fadeOut("slow");
});
</script>
</head>
<style>
* {
text-align: center !important;
color: white !important;
}
button {
transition-duration: 0.5s;
background-color: rgba(0, 0, 0, 0.25);
border-radius: 10px;
border: 5px solid rgba(0, 0, 0, 0.2);
}
button:hover {
background-color: rgba(0, 0, 0, 0.4);
border: 5px solid rgba(0, 0, 0, 0.3);
}
body {
background-image: url(https://source.unsplash.com/random/?sunset);
background-position: center;
background-size: cover;
}
</style>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<script>
$("h1, h2, h3")
.css("text-align", "center")
.append(
'<hr style="height: 1px; background: linear-gradient(to right, transparent , var(--color), transparent); padding: 0px; border: none;">'
);
</script>