One feature of my project is the ability to change the site theme with a simple click:
<ul>
<li class="=contact"><a href="#">Contact</a></li>
<li class="facebook"><a href="#">Facebook</a></li>
<li class="twitter"><a href="#">Twitter</a></li>
<li class="rss"><a href="#">Feed Rss</a></li>
<li class="change-theme"><a href="#">Change Theme</a></li>
</ul>
Clicking on the link within the <li class="change-theme">
triggers the following script:
$('.change-theme').click(function () {
$('body').toggleClass('theme-dark');
});
This adds the class theme-dark
, thereby changing the site theme. However, upon page refresh, the default theme reverts back.
Is there a way to save the chosen theme and maintain it even after browser updates?