mirror of
https://github.com/EyeTrackVR/EyeTrackVR-Docs.git
synced 2025-11-04 14:49:44 +08:00
update - dark-mode button now changes the text according to the state.
This commit is contained in:
parent
bb57ec595d
commit
cc95ca560d
@ -2,3 +2,17 @@
|
||||
<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 = "Light Mode";
|
||||
} else {
|
||||
isClicked = false;
|
||||
switch_scheme.textContent = "Dark Mode";
|
||||
}
|
||||
await switchScheme(isClicked);
|
||||
}
|
||||
</script>
|
||||
@ -1,17 +1,9 @@
|
||||
var isClicked = false;
|
||||
async function toggleDetect() {
|
||||
if (isClicked == false) {
|
||||
isClicked = true;
|
||||
} else {
|
||||
isClicked = false;
|
||||
}
|
||||
await switchScheme(isClicked);
|
||||
}
|
||||
|
||||
async function switchScheme(isClicked) {
|
||||
if (isClicked == true) {
|
||||
jtd.setTheme("eyetrackvr");
|
||||
switch_scheme.textContent = "Light Mode";
|
||||
} else {
|
||||
jtd.setTheme("light");
|
||||
switch_scheme.textContent = "Dark Mode";
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user