-
Notifications
You must be signed in to change notification settings - Fork 0
/
space_wiki.html
238 lines (210 loc) · 9.68 KB
/
space_wiki.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cosmo Cruise | Space Wiki</title>
<!-- Bootstrap 5 CDN -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
<!-- Custom CSS -->
<link rel="stylesheet" href="css/index.css">
<link rel="stylesheet" href="css/crouselStyle.css">
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Lekton&family=MedievalSharp&family=Poppins&display=swap"
rel="stylesheet">
<style>
.fade-in2 {
text-align: left;
}
.buffer {
margin: 0px;
}
@media (max-width: 800px) {
.buffer {
margin: -20px;
}
.buffermobile {
margin: -10px;
}
.carousel-caption h2 {
font-size: 20px;
}
.carousel-caption h3 {
position: absolute;
right: 15%;
bottom: 11rem;
left: -10px;
padding-top: 1.25rem;
padding-bottom: 1.25rem;
color: #fff;
text-align: left;
font-size: 20px;
}
.animatedrop {
opacity: 0;
margin-top: 10px;
padding: 10px;
width: 280px;
background-color: #34495e;
}
}
</style>
</head>
<body>
<div id="carouselExampleFade" class="carousel slide carousel-fade" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img id="nasa_image1" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<div class="fade-in2">
<h2 class="buffer text-center" id="title1"></h2>
</div>
</div>
</div>
<div class="carousel-item">
<img id="nasa_image2" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<div class="fade-in2">
<h2 class="buffer text-center" id="title2"></h2>
</div>
</div>
</div>
<div class="carousel-item">
<img id="nasa_image3" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<div class="fade-in2">
<h2 class="buffer text-center" id="title3"></h2>
</div>
</div>
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleFade" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleFade" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
<div class="text-center">
<h1 class="text-white my-5">Discover</h1>
</div>
<div class="container mt-3" data-bs-theme="dark">
<div class="row">
<div class="col-md-12">
<div class="card mb-3" style="max-width: 100%;">
<div class="row g-0">
<div class="col-md-4">
<img id="nasa_imagecard1" class="img-fluid rounded-start" alt="loading..">
</div>
<div class="col-md-8">
<div class="card-body h-100">
<h5 class="card-title" id="titlecard1"></h5>
<p class="card-text" id="description1"></p>
<p class="card-text"><small class="text-body-secondary" id="date1"></small></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="card mb-3" style="max-width: 100%;">
<div class="row g-0">
<div class="col-md-4">
<img id="nasa_imagecard2" class="img-fluid rounded-start" alt="loading..">
</div>
<div class="col-md-8">
<div class="card-body h-100">
<h5 class="card-title" id="titlecard2"></h5>
<p class="card-text" id="description2"></p>
<p class="card-text"><small class="text-body-secondary" id="date2"></small></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="card mb-3" style="max-width: 100%;">
<div class="row g-0">
<div class="col-md-4">
<img id="nasa_imagecard3" class="img-fluid rounded-start" alt="loading..">
</div>
<div class="col-md-8">
<div class="card-body h-100">
<h5 class="card-title" id="titlecard3"></h5>
<p class="card-text" id="description3"></p>
<p class="card-text"><small class="text-body-secondary" id="date3"></small></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- <div class="container d-flex justify-content-evenly my-5">
<div id="img_container">
<img class="img-fluid" id="nasa_image" alt="NASA Image">
</div>
<div class="content text-white px-5 w-100">
<h1 id="title"></h1>
<p id="description"></p>
<p><strong>Date:</strong> <span id="date"></span></p>
<p><strong>Media Type:</strong> <span id="media_type"></span></p>
<p><strong>Service Version:</strong> <span id="service_version"></span></p>
<p><strong>Copyright:</strong> <span id="copyright"></span></p>
</div>
</div> -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
var exampleURL = 'https://api.nasa.gov/planetary/apod';
// var targetDate = '2023-09-27';
var apiKey = 'pbvowu4udDgeTShZHFU6zCTTd1QjChKL0tokS77x'; // Replace with your actual NASA API key
var fullURL = exampleURL + '?api_key=' + apiKey + '&count=' + 5;
// var fullURL = exampleURL + '?api_key=' + apiKey + '&date=' + targetDate;
$.ajax({
url: fullURL,
success: function (response) {
$('#nasa_image1').attr('src', response[0].url);
$('#nasa_image2').attr('src', response[1].url);
$('#nasa_image3').attr('src', response[2].url);
$('#nasa_imagecard1').attr('src', response[0].url);
$('#nasa_imagecard2').attr('src', response[1].url);
$('#nasa_imagecard3').attr('src', response[2].url);
$('#title1').text(response[0].title);
$('#title2').text(response[1].title);
$('#title3').text(response[2].title);
$('#titlecard1').text(response[0].title);
$('#titlecard2').text(response[1].title);
$('#titlecard3').text(response[2].title);
$('#description1').text(response[0].explanation);
$('#description2').text(response[1].explanation);
$('#description3').text(response[2].explanation);
$('#date1').text(response[0].date);
$('#date2').text(response[1].date);
$('#date3').text(response[2].date);
$('#media_type').text(response[0].media_type);
$('#service_version').text(response[0].service_version);
$('#copyright').text(response[0].copyright);
},
error: function (xhr, status, error) {
console.log('Error in network request:', error);
}
});
});
</script>
</body>
</html>