From ab23604fb0c19c0d7b8cfb9cdada55780cf393ba Mon Sep 17 00:00:00 2001 From: squidfunk Date: Fri, 24 Mar 2023 11:36:30 +0100 Subject: [PATCH] Removed flickering of color palette demo --- docs/setup/changing-the-colors.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/setup/changing-the-colors.md b/docs/setup/changing-the-colors.md index 15e6d0244..07106b8eb 100644 --- a/docs/setup/changing-the-colors.md +++ b/docs/setup/changing-the-colors.md @@ -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") + }) }) })