How to toggle button class on cookie/active
-
So the idea is to change the icon to moon / sun for dark or normal mode. I don’t know how to retrieve the cookie value, the following code works except after clicking on a link while in dark mode, it loads the moon icon
$(function() { $('.wpnm-button').click(function() { if($('body').hasClass('wp-night-mode-on')){ $('.toggle-fontawesome').find('i').removeClass('fa-moon'); $('.toggle-fontawesome').find('i').addClass('fa-sun'); } else{ $('.toggle-fontawesome').find('i').removeClass('fa-sun'); $('.toggle-fontawesome').find('i').addClass('fa-moon'); } }); });*/
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘How to toggle button class on cookie/active’ is closed to new replies.