summaryrefslogtreecommitdiff
path: root/src/scripts/zoom.js
blob: 82465ecb910e57f4d8da111087f23321aa6aad9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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"; 
    }
}