26 lines
679 B
JavaScript
26 lines
679 B
JavaScript
var fontSize = parseInt(localStorage.getItem("fontSize") ?? 100)
|
|
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)
|
|
}
|
|
|
|
// add buttons
|
|
document.body.innerHTML +=
|
|
"<div class=\"font_scaler\">" +
|
|
"<button onclick=\"big()\"><img src=\"increasefont.svg\"/></button>" +
|
|
"<button onclick=\"small()\"><img src=\"decreasefont.svg\"/></button>" +
|
|
"</div>"
|
|
|