Skip to content

Commit

Permalink
update data atttribute on button
Browse files Browse the repository at this point in the history
  • Loading branch information
p0wen committed Sep 28, 2020
1 parent b836437 commit be6b6b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/js/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ function changeBackground() {
let bgimage = "";
changeBackgroundBTN.forEach((option) => {
option.addEventListener("click", function () {
bgimage = this.getAttribute("bg-img");
bgimage = this.getAttribute("data-bg");
if (bgimage == "morning") {
// Use Morning Background
document.getElementById("myDiv").style.backgroundImage =
Expand Down
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ <h5>Background</h5>
<button
type="button"
class="btng"
bg-img="morning"
data-bg="morning"
aria-label="Morning Background"
>
<i class="fas fa-sun" aria-hidden="true"></i>
Expand All @@ -258,7 +258,7 @@ <h5>Background</h5>
<button
type="button"
class="btng"
bg-img="afternoon"
data-bg="afternoon"
aria-label="Afternoon Background"
>
<i class="fas fa-moon" aria-hidden="true"></i>
Expand All @@ -271,7 +271,7 @@ <h5>Background</h5>
<button
type="button"
class="btng"
bg-img="random"
data-bg="random"
aria-label="Random Background"
>
<i class="fas fa-random" aria-hidden="true"></i>
Expand Down

0 comments on commit be6b6b4

Please sign in to comment.