mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Removed flickering of color palette demo
This commit is contained in:
parent
70d1002a1d
commit
ab23604fb0
@ -38,10 +38,14 @@ Click on a tile to change the color scheme:
|
|||||||
var buttons = document.querySelectorAll("button[data-md-color-scheme]")
|
var buttons = document.querySelectorAll("button[data-md-color-scheme]")
|
||||||
buttons.forEach(function(button) {
|
buttons.forEach(function(button) {
|
||||||
button.addEventListener("click", function() {
|
button.addEventListener("click", function() {
|
||||||
|
document.body.setAttribute("data-md-color-switching", "")
|
||||||
var attr = this.getAttribute("data-md-color-scheme")
|
var attr = this.getAttribute("data-md-color-scheme")
|
||||||
document.body.setAttribute("data-md-color-scheme", attr)
|
document.body.setAttribute("data-md-color-scheme", attr)
|
||||||
var name = document.querySelector("#__code_0 code span.l")
|
var name = document.querySelector("#__code_0 code span.l")
|
||||||
name.textContent = attr
|
name.textContent = attr
|
||||||
|
setTimeout(function() {
|
||||||
|
document.body.removeAttribute("data-md-color-switching")
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user