From dc0b1f96af82cc368a715af300167681acc4e475 Mon Sep 17 00:00:00 2001 From: srivani vinnakota <164530944+sv410@users.noreply.github.com> Date: Sun, 13 Oct 2024 14:15:39 +0530 Subject: [PATCH] Create dark_light.js --- dark_light.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 dark_light.js diff --git a/dark_light.js b/dark_light.js new file mode 100644 index 00000000..ab713444 --- /dev/null +++ b/dark_light.js @@ -0,0 +1,7 @@ +toggle_switch = document.querySelector('#dark-mode'); + +toggle_switch.addEventListener 'input', -> + label = @labels[0]; + body = document.body; + + body.dataset.darkMode = label.dataset.darkMode = @checked;