Summary Files Commits Branches @commit @diff @stats
path: root / src / scripts
diff options
context:
space:
mode:
Commita743d9a59031f42fc87c4eef3c5950dd3747c9cc (patch)
Author
 Kamen Mladenov <kamen.d.mladenov@protonmail.com>
2022-02-20 16:15:08 +0000
Committer
 Kamen Mladenov <kamen.d.mladenov@protonmail.com>
2022-02-20 16:15:08 +0000
Files94886a67c26511ad7127941f841ee25e6eb0fb34 /src/scripts
syndamia.com-a743d9a59031f42fc87c4eef3c5950dd3747c9cc.tar
syndamia.com-a743d9a59031f42fc87c4eef3c5950dd3747c9cc.tar.gz
syndamia.com-a743d9a59031f42fc87c4eef3c5950dd3747c9cc.zip
Parent2288151c5cd34f04cd10cd35565d278d06a301f3 (diff)
Parent009cb25eb083bbc5ccc0d26977dfc47e0b7166bb (diff)
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.js10
-rw-r--r--src/scripts/image-show.js2
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;
}
}