I am trying to create a jQuery cookie to remember the new font size generated by the code below. I am already using jQuery Cookies in my project for another function but can't figure out how to do it.
This is the jQuery I am using to let users choose a font size that works best for them:
$(document).ready(function(){
var resize = new Array('p','.resizable');
resize = resize.join(',');
//resets the font size when "reset" is clicked
var resetFont = $(resize).css('font-size');
$("#reset").click(function(){
$(resize).css('font-size', resetFont);
//reset theme color
$("#trenbiz" ).attr("href", "/js/skin/skin1.css" );
return false;
});
//increases font size when "+" is clicked
$("#increase").click(function(){
var originalFontSize = $(resize).css('font-size');
var originalFontNumber = parseFloat(originalFontSize, 10);
var newFontSize = originalFontNumber*1.1;
$(resize).css('font-size', newFontSize);
return false;
});
//decrease font size when "-" is clicked
$("#decrease").click(function(){
var originalFontSize = $(resize).css('font-size');
var originalFontNumber = parseFloat(originalFontSize, 10);
var newFontSize = originalFontNumber*0.8;
$(resize).css('font-size', newFontSize);
return false;
});
I tried following the jQuery Cookies doc and just filled in the basic example with my own class names: $.cookie('font-size', 'newFontSize');
but it didn't work. Not sure if its not picking up a value or if it isn't applying it.
Any help at all would be incredibly appreciated!