Skip to content

Commit

Permalink
fix routing of images
Browse files Browse the repository at this point in the history
  • Loading branch information
p0wen committed Sep 18, 2020
1 parent 0b6f17c commit 22fe5d0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions assets/js/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const currentHour = new Date().getHours();
if (currentHour > 0 && currentHour < 12) {
// after Midnight and before 12:00PM
document.getElementById("myDiv").style.backgroundImage =
"url('../assets/media/img/sunrise.jpg')";
"url('assets/media/img/sunrise.jpg')";
} else if (currentHour >= 12) {
// after 12:00PM
document.getElementById("myDiv").style.backgroundImage =
"url('../assets/media/img/afternoon.jpg')";
"url('assets/media/img/afternoon.jpg')";
}

let changeBackgroundBTN = document.querySelectorAll(".changebackground button");
Expand All @@ -21,11 +21,11 @@ function changeBackground() {
bgimage = this.getAttribute("background-img");
if (bgimage == "morning") {
// Use Morning Background
document.getElementById("myDiv").style.backgroundImage = "url('../assets/media/img/sunrise.jpg')";
document.getElementById("myDiv").style.backgroundImage = "url('assets/media/img/sunrise.jpg')";
}
else if (bgimage == "afternoon") {
// after 12:00PM
document.getElementById("myDiv").style.backgroundImage = "url('../assets/media/img/afternoon.jpg')";
document.getElementById("myDiv").style.backgroundImage = "url('assets/media/img/afternoon.jpg')";
}
else if (bgimage == "random") {
// use random background from unsplash
Expand Down

0 comments on commit 22fe5d0

Please sign in to comment.