I am trying to make a light/dark theme of settings. but I have settings on another page so when I go to setting and pick a theme and go to homepage my theme resets to the original.
my jquery code:
$(document).ready(function(){
$(":radio").click(function(){
if( $("#btnradio1").is(':checked')){
if ($("body").hasClass("ndark")) {
$.removeCookie('theme2');
$("body").removeClass("ndark").addClass("nlight");
$("nav").removeClass("navd").addClass("navl");
$("nav").removeClass("white").addClass("pis");
$.cookie('theme1', $('btnradio1'));
$.cookie('theme1');
console.log($.cookie('theme1'));
}
} else {
$.removeCookie('tema1');
$("body").removeClass("nlight").addClass("ndark");
$("nav").removeClass("navl").addClass("navd");
$.cookie('theme2', $('btnradio2'));
$.cookie('theme2');
console.log($.cookie('theme2'));
}
});
});
and here are some imagese for better understanding:
before setting light mode
,
setting light mode
,
after setting and click home link
,