summaryrefslogtreecommitdiff
path: root/src/scripts/zoom.js
diff options
context:
space:
mode:
authoraltaf-creator <athaalaa@gmail.com>2023-07-17 14:16:21 +0700
committeraltaf-creator <athaalaa@gmail.com>2023-07-17 14:16:21 +0700
commit12efa76e679624563d508685ac17d411c3c4441e (patch)
tree449f9a18206aff346522c214ad9e95a26c42c29e /src/scripts/zoom.js
parent0b7f5bb72a6cb913927e3b1dd4024287a9b26d29 (diff)
Added zoom feature, Added sura index
Diffstat (limited to 'src/scripts/zoom.js')
-rw-r--r--src/scripts/zoom.js30
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