So I’m trying to load a default stylesheet called one.css when you come to my page the first time. Other than that I was the user to be able to select a theme. The problem with my logic is when you switch to another style the one.css seems to be resetting the local storage as if it were your first time on the site.
Yes I do realize the logic is there just wrong hopefully someone can sort out what I’m trying to do.
var firstRun = (localStorage['styler'] == 'one');
if (!firstRun) {
localStorage['styler'] = 'one';
var style = localStorage["styler"];
$('<link rel="stylesheet" type="text/css" href="'+style + '.css">').appendTo("head");
}
else{
var style = localStorage["styler"];
$('<link rel="stylesheet" type="text/css" href="'+style + '.css">').appendTo("head");
}
I think you are looking for: