From edda70d3ce7c5cf939d7c1fcaf9ea8def7a42e7c Mon Sep 17 00:00:00 2001 From: Rahulpersie66 Date: Wed, 24 Jan 2024 21:59:14 -0500 Subject: [PATCH] added night toggle functionality and javascript coding for that --- .vscode/launch.json | 15 +++++++++++++++ index.css | 3 +++ index.html | 29 ++++++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 index.css diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..2ba986f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8080", + "webRoot": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/index.css b/index.css new file mode 100644 index 0000000..75c5ef0 --- /dev/null +++ b/index.css @@ -0,0 +1,3 @@ +@media screen and (max-width:600px) { + +} \ No newline at end of file diff --git a/index.html b/index.html index d9104af..e252cce 100644 --- a/index.html +++ b/index.html @@ -2,10 +2,11 @@ - + + -
-
+ + +
+ 🌙
@@ -265,6 +280,14 @@ calculation.textContent = result.textContent; }); + // Add the night mode toggle functionality + // By Rahul + const nightModeToggle = document.querySelector('.nightModeToggle'); + const body = document.body; + + nightModeToggle.addEventListener('click', function () { + body.classList.toggle('dark-mode'); + });