EyeTrackVR-Docs/docs/_includes/header_custom.html
ZanzyTHEbar 9f029fc8f1 Fix FAQ to have section support, change the type to add a new section
Fix dark-mode toggle button (now works great)
2022-07-08 17:22:36 +01:00

20 lines
698 B
HTML

<ul>
<a href="javascript:toggleDetect()" title="Switching Schemes" class="btn btn-mode fs-2 mb-1 mb-md-0 mr-0"
id="switch-mode">Dark Mode</a>
</ul>
<script type="text/javascript">
const switch_scheme = document.getElementById("switch-mode");
var isClicked = false;
async function toggleDetect() {
if (isClicked == false) {
isClicked = true;
switch_scheme.textContent = "Dark Mode";
localStorage.setItem("theme", "light");
} else {
isClicked = false;
switch_scheme.textContent = "Light Mode";
localStorage.setItem("theme", "dark");
}
await switchScheme();
}
</script>