Hey there, I’m trying to set up some custom code by having the user click a light switch to change the background colour to black across all pages, and changing it back to blue if you click the switch again. I’d ideally also like images to change when clicked too (light switch changing to “on”, and a lightbulb on the page turning on and off) but I’d just like to get the background color change to work first.
I’ve been battling with ChatGPT to make the code for me as I’m inexperienced but nothing has worked so far.
Does anyone know if this is possible on Readymag?
this is possible, yes…
you would need to figure out which html element you need to change into your desired color via the dev-tools.
Then with js/jquery you can set up a function like: on click on this element (your switch) change everything to “black” or / “blue”.
Make sure to not use "ondocumentready or onload functions around your code. instead set evereything inside a settimeout function with around 2 seconds to make sure every element you are adressing is loaded before your code is executed. (this is RM specific and was maybe your problem in trying.)
look on stackoverflow how to adress the elements and set up the code.