I've added a button on a website so the user can leave it in "night mode". But if he goes to a new story, the site will have night mode turned off.
Is it possible to have the browser cache this information, so that once it leaves the mode in night mode, the other news it accesses are already with this class?
var menu = document.querySelector('body.single-news');
var button = document.querySelector('button#skin-btn');
button.addEventListener('click', function() {
var open = menu.classList.contains('light-skin');
menu.classList.toggle('light-skin');
});
Removing the "light-skin" class activates the night mode.