Skip to content

Commit ab23604

Browse files
committed
Removed flickering of color palette demo
1 parent 70d1002 commit ab23604

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/setup/changing-the-colors.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@ Click on a tile to change the color scheme:
3838
var buttons = document.querySelectorAll("button[data-md-color-scheme]")
3939
buttons.forEach(function(button) {
4040
button.addEventListener("click", function() {
41+
document.body.setAttribute("data-md-color-switching", "")
4142
var attr = this.getAttribute("data-md-color-scheme")
4243
document.body.setAttribute("data-md-color-scheme", attr)
4344
var name = document.querySelector("#__code_0 code span.l")
4445
name.textContent = attr
46+
setTimeout(function() {
47+
document.body.removeAttribute("data-md-color-switching")
48+
})
4549
})
4650
})
4751
</script>

0 commit comments

Comments
 (0)