Hey there! I have a small question. I want to resize all HTML elements using jQuery, but the current code allows me to increase and decrease the size infinitely.
var originalSize = $('html').css('font-size');
// Reset
$(".resetMe").click(function(){
$('html').css('font-size', originalSize);
});
// Increase Font Size
$(".increase").click(function(){
var currentSize = $('html').css('font-size');
var increasedSize = parseFloat(currentSize) * 1.05;
$('html').css('font-size', increasedSize);
return false;
});
// Decrease Font Size
$(".decrease").click(function(){
var currentFontSize = $('html').css('font-size');
var decreasedSize = parseFloat(currentFontSize) * 0.8;
$('html').css('font-size', decreasedSize);
return false;
});
I'm looking for a way to limit how many times the font size can be increased or decreased. Any ideas on how to edit this code?