From 2673354d5a7846f98570ccfac47fc641bcd5f705 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 20 Feb 2022 10:07:19 +0200 Subject: Added information regarding javascript (and information about tiny syndamia dot com) --- src/_footer.html | 1 + 1 file changed, 1 insertion(+) (limited to 'src/_footer.html') diff --git a/src/_footer.html b/src/_footer.html index 0bce5fd..32da16f 100644 --- a/src/_footer.html +++ b/src/_footer.html @@ -2,6 +2,7 @@ + + diff --git a/src/scripts/image-show.js b/src/scripts/image-show.js new file mode 100644 index 0000000..1683107 --- /dev/null +++ b/src/scripts/image-show.js @@ -0,0 +1,24 @@ +let scrollPosition = 0; + +function clickToView() { + if (scrollPosition === 0) { + scrollPosition = window.scrollY; + window.scrollTo(0, 0); + } + + this.classList.toggle('clicked-image'); + document.body.classList.toggle('body-on-clicked-image'); + + if (this.className.length === 0) { + window.scrollTo(0, scrollPosition); + scrollPosition = 0; + } +} + +const images = document.getElementsByTagName('img'); + +for (const image of images) { + if (image.alt !== '🔗') { + image.onclick = clickToView; + } +} diff --git a/src/styles.css b/src/styles.css index 5ecf230..abe7006 100644 --- a/src/styles.css +++ b/src/styles.css @@ -58,10 +58,6 @@ img { image-rendering: crisp-edges; } -img:hover { - image-rendering: pixelated; -} - img, hr { border: 1px solid black; } @@ -360,6 +356,25 @@ code span { color: #afaf00; } +/* Script specific styling */ + +.clicked-image { + position: absolute; + width: 100vw; + height: 100vh; + max-width: none !important; + max-height: none !important; + border: none; + object-fit: contain; + left: 0; + top: 0; + padding: 1em; +} + +.body-on-clicked-image { + overflow: hidden; +} + /* OpenSans font */ @font-face { -- cgit v1.3.1-26-gb76a From d4886f28cead7d0c2b77d791c5077ba9d525e0a0 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 20 Feb 2022 13:49:06 +0200 Subject: Removed _blank target from regarding-js footer link --- src/_footer.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/_footer.html') diff --git a/src/_footer.html b/src/_footer.html index b498d55..9ca082f 100644 --- a/src/_footer.html +++ b/src/_footer.html @@ -2,7 +2,7 @@