I have set up 3 buttons that change the font size of the web page. I'm struggling to figure out how to save the selection so that it works across all the pages without having to click a button every time a load pages.
Here's what my buttons look like
$("#small").click(function(){
$("p").animate({"font-size":"1em"});
$("h1").animate({"font-size":"3em"});
$("h2").animate({"font-size":"1.5em"});
$("h3").animate({"font-size":" 1.25em"});
}
);
$("#medium").click(function(){
$("p").animate({"font-size":"1.5em"});
$("h1").animate({"font-size":"3.5em"});
$("h2").animate({"font-size":"2em"});
$("h3").animate({"font-size":" 1.75em"});
}
);
$("#large").click(function(){
$("p").animate({"font-size":"2em"});
$("h1").animate({"font-size":"4em"});
$("h2").animate({"font-size":"2.5em"});
$("h3").animate({"font-size":" 2.25em"});
}
);
I'm trying to use localStorage to save the selection, but I can't figure out how to get that to work... I've searched stackoverflow I've found similar questions but not the answer I'm looking for.
I got flagged for asking a similar question I guess, but I went over it and don't really see how it applies. Could I use localStorage.setItem on each item like so?
$("#large").click(function(){
localStorage.setItem($("p").animate({"font-size":"2em"}));
);
Edit: Nope, that didn't work at all.