From b21254be94f4b7f269732aa579a81a9f9ee73a51 Mon Sep 17 00:00:00 2001 From: Rosia E Evans Date: Sat, 26 Apr 2025 12:45:18 +0100 Subject: [PATCH] adds font resizing --- fontScaler.js | 25 +++++++++++++++++++++---- style.css | 3 +++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/fontScaler.js b/fontScaler.js index c09116e..e830d67 100644 --- a/fontScaler.js +++ b/fontScaler.js @@ -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 += "
" + - "" + - "" + + "" + + "" + "
" -// code to make buttons work diff --git a/style.css b/style.css index 2f67de5..05920b8 100644 --- a/style.css +++ b/style.css @@ -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; }