08.03.2024, 13:38
(08.03.2024, 09:18)admin Wrote: Add this to Custom JavaScript:
Code:$(function(){
if (window.Storage) {
var dark = !!Storage.get('darkmode', '');
$('body').toggleClass('dark', dark);
$('.toggle-dark-mode').off('vclick').on('vclick', function() {
dark = !dark;
Storage.set('darkmode', dark ? 'y' : '');
$('body').toggleClass('dark', dark);
});
}
});
Create a dummy object and attach a visualization element to it. Set Additional classes to toggle-dark-mode
Clicking this element will toggle between light/dark mode. This setting is stored in browser's local storage.
when I switch from one mode to another the page trends do not immediately change color. I have to refresh the page manually