flower-article / flower-page.js
flower-page.js
Raw
function lovelyTheme() {
  let div = document.querySelector("div");
  let body = document.querySelector("body");

  if (div.classList.contains("ptheme") && body.classList.contains("bptheme")) {
    div.classList.remove("ptheme");
    body.classList.remove("bptheme");
  } else {
    div.classList.add("ptheme");
    body.classList.add("bptheme");
  }
}

let button = document.getElementById("themebutton");
button.addEventListener("click", lovelyTheme);