adds font resizing
This commit is contained in:
parent
5d4d0a46c3
commit
b21254be94
2 changed files with 24 additions and 4 deletions
|
@ -1,9 +1,26 @@
|
||||||
console.log(document)
|
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
|
// add buttons
|
||||||
document.body.innerHTML +=
|
document.body.innerHTML +=
|
||||||
"<div class=\"font_scaler\">" +
|
"<div class=\"font_scaler\">" +
|
||||||
"<button><img src=\"increasefont.svg\"/></button>" +
|
"<button onclick=\"big()\"><img src=\"increasefont.svg\"/></button>" +
|
||||||
"<button><img src=\"decreasefont.svg\"/></button>" +
|
"<button onclick=\"small()\"><img src=\"decreasefont.svg\"/></button>" +
|
||||||
"</div>"
|
"</div>"
|
||||||
|
|
||||||
// code to make buttons work
|
|
||||||
|
|
|
@ -169,12 +169,15 @@ main .socials{
|
||||||
|
|
||||||
.font_scaler{
|
.font_scaler{
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
}
|
}
|
||||||
.font_scaler button{
|
.font_scaler button{
|
||||||
background: none;
|
background: none;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
border: none;
|
border: none;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
transition: background-color 0.5s;
|
transition: background-color 0.5s;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue