diff options
Diffstat (limited to 'src/scripts/zoom.js')
-rw-r--r-- | src/scripts/zoom.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/scripts/zoom.js b/src/scripts/zoom.js new file mode 100644 index 0000000..82465ec --- /dev/null +++ b/src/scripts/zoom.js @@ -0,0 +1,30 @@ +var zoomLevel = 1; + +function zoomIn() { + if (zoomLevel < 2) { + zoomLevel += .1; + } +} + +function zoomOut() { + if (zoomLevel > 0.6 ) { + zoomLevel -= .1; + } +} + +function updateZoom() { + const elements = document.getElementsByTagName("li"); + const zoomText = document.getElementById("zoomText"); + const zoomTextAlt = document.getElementById("zoomTextAlt"); + const suraOl = document.getElementById("sura-ol"); + + zoomText.innerHTML = Math.round((100 * zoomLevel)).toString() + "%"; + zoomTextAlt.innerHTML = Math.round((100 * zoomLevel)).toString() + "%"; + suraOl.style.fontSize = (1 * zoomLevel).toString() + "em"; + suraOl.style.paddingLeft = (40 * zoomLevel * 1.25).toString() + "px"; + + for (var i = 0; i < elements.length; i++) { + elements[i].style.fontSize = (28 * zoomLevel).toString() + "px"; + elements[i].style.lineHeight = ((28 * zoomLevel) + (44 * zoomLevel * 0.7)).toString() + "px"; + } +}
\ No newline at end of file |