Created
December 7, 2020 03:50
-
-
Save anLpk/c13a719e90c14e299d0475f327566151 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| const toggleTextColor = document.querySelector(".darktext"); | |
| const switchBtn = document.querySelector(".switch"); | |
| const bodyColorChanges = document.querySelector("body"); | |
| const cardBgColorChanges = document.querySelector(".dark"); | |
| const changeTextColor = function () { | |
| toggleTextColor.classList.remove("darktext"); | |
| }; | |
| const changeCardColor = function () { | |
| cardBgColorChanges.style.backgroundColor = "hsl(227, 47%, 96%)"; | |
| }; | |
| switchBtn.addEventListener("click", changeTextColor); | |
| switchBtn.addEventListener("click", changeCardColor); | |
| switchBtn.addEventListener("click", function () { | |
| bodyColorChanges.style.backgroundColor = "white"; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment