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
|
||||
document.body.innerHTML +=
|
||||
"<div class=\"font_scaler\">" +
|
||||
"<button><img src=\"increasefont.svg\"/></button>" +
|
||||
"<button><img src=\"decreasefont.svg\"/></button>" +
|
||||
"<button onclick=\"big()\"><img src=\"increasefont.svg\"/></button>" +
|
||||
"<button onclick=\"small()\"><img src=\"decreasefont.svg\"/></button>" +
|
||||
"</div>"
|
||||
|
||||
// code to make buttons work
|
||||
|
|
|
@ -169,12 +169,15 @@ main .socials{
|
|||
|
||||
.font_scaler{
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
.font_scaler button{
|
||||
background: none;
|
||||
background-color: white;
|
||||
border: none;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 10px;
|
||||
padding: 5px;
|
||||
transition: background-color 0.5s;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue