diff options
Merge branch 'back-to-top' into 'master'
Back to top
See merge request Syndamia/syndamiadotcom!3
2 files changed, 11 insertions, 1 deletions
| -rw-r--r-- | src/scripts/back-to-top.js | 10 | ||||
| -rw-r--r-- | src/scripts/image-show.js | 2 |
diff --git a/src/scripts/back-to-top.js b/src/scripts/back-to-top.js new file mode 100644 index 0000000..be1a1c3 --- /dev/null +++ b/src/scripts/back-to-top.js @@ -0,0 +1,10 @@ +const scrollBtn = document.getElementById('scrollBtn'); + +window.onscroll = function() { + if (window.scrollY >= 800) { + scrollBtn.style.display = 'block'; + } else { + scrollBtn.style.display = 'none'; + } +} + diff --git a/src/scripts/image-show.js b/src/scripts/image-show.js index b1ca7cf..961242e 100644 --- a/src/scripts/image-show.js +++ b/src/scripts/image-show.js @@ -18,7 +18,7 @@ function clickToView() { const images = document.getElementsByTagName('img'); for (const image of images) { - if (image.alt !== '🔗') { + if (image.alt !== '🔗' && image.id !== 'scrollBtn') { image.onclick = clickToView; } } |