PawsAndPetals/fontScaler.js

27 lines
679 B
JavaScript
Raw Normal View History

2025-04-26 13:14:45 +01:00
var fontSize = parseInt(localStorage.getItem("fontSize") ?? 100)
2025-04-26 12:45:18 +01:00
document.documentElement.style.fontSize = fontSize + "%";
// code to make buttons work
function big()
{
fontSize += 10;
document.documentElement.style.fontSize = fontSize + "%";
localStorage.setItem("fontSize", fontSize)
}
function small()
{
fontSize -= 10;
document.documentElement.style.fontSize = fontSize + "%";
localStorage.setItem("fontSize", fontSize)
}
2025-04-01 09:18:49 +00:00
// add buttons
document.body.innerHTML +=
"<div class=\"font_scaler\">" +
2025-04-26 12:45:18 +01:00
"<button onclick=\"big()\"><img src=\"increasefont.svg\"/></button>" +
"<button onclick=\"small()\"><img src=\"decreasefont.svg\"/></button>" +
2025-04-01 09:18:49 +00:00
"</div>"