-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
53 lines (52 loc) · 2.61 KB
/
index.html
File metadata and controls
53 lines (52 loc) · 2.61 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>My NASA webpage</title>
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
<!-- Font Awesome icons (free version)-->
<script src="https://use.fontawesome.com/releases/v6.1.0/js/all.js" crossorigin="anonymous"></script>
<!-- Google fonts-->
<link href="https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" rel="stylesheet" type="text/css" />
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="css/styles.css" rel="stylesheet" />
</head>
<body>
<!-- Page Header-->
<header id="nasa_img" class="masthead" style="background-image: url('assets/img/home-bg.jpg')">
<div class="container position-relative px-4 px-lg-5">
<div class="row gx-4 gx-lg-5 justify-content-center">
<div class="col-md-10 col-lg-8 col-xl-7">
<div class="site-heading">
<h2> ERROR CAUSED Welcome to NASA Astronomy picture of the next day</h2>
<p id="pic_text">This content will be replaced by NASA API call</p>
<h2>See you soon!</h2>
</div>
</div>
</div>
</div>
</header>
<!-- JS to gather data from NASA -->
<script>
fetch('https://api.nasa.gov/planetary/apod?api_key=30wKykhzibTOdpJo9xJ0waYUDXLdfBxfXBZE5SEr')
.then(response => response.json())
.then (function(data){
console.log(data);
document.getElementById("nasa_img").style = "background-image: url("+data.url+")";
document.getElementById("pic_text").innerHTML = data.explanation;
})
.catch(function(error) {
console.log("This is an ERROR");
});
</script>
<noscript>Sorry, your browser does not support JavaScript!!</noscript>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="js/scripts.js"></script>
</body>
</html>