Skip to content

Commit

Permalink
Removed flickering of color palette demo
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Mar 24, 2023
1 parent 70d1002 commit ab23604
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/setup/changing-the-colors.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ Click on a tile to change the color scheme:
var buttons = document.querySelectorAll("button[data-md-color-scheme]")
buttons.forEach(function(button) {
button.addEventListener("click", function() {
document.body.setAttribute("data-md-color-switching", "")
var attr = this.getAttribute("data-md-color-scheme")
document.body.setAttribute("data-md-color-scheme", attr)
var name = document.querySelector("#__code_0 code span.l")
name.textContent = attr
setTimeout(function() {
document.body.removeAttribute("data-md-color-switching")
})
})
})
</script>
Expand Down

0 comments on commit ab23604

Please sign in to comment.