diff --git a/files/global.css b/files/global.css
index 77d9c58..e40f761 100644
--- a/files/global.css
+++ b/files/global.css
@@ -164,6 +164,18 @@ figure {
object-fit: contain;
}
+#totop {
+ display: none;
+ position: fixed;
+ bottom: 40px;
+ right: 30px;
+ z-index: 99;
+ cursor: pointer;
+ padding: 14px;
+ border-radius: 10px;
+ border-style: none;
+}
+
/* Responsive layout - makes a four column-layout instead of eight columns */
@media screen and (max-width: 1000px) {
.column {
diff --git a/templates/index.html.j2 b/templates/index.html.j2
index 574aa7c..50d35e3 100644
--- a/templates/index.html.j2
+++ b/templates/index.html.j2
@@ -94,6 +94,7 @@
{%- endif %}
Made with StaticGalleryBuilder by Flo Greistorfer.
+
{%- endif %}
{%- else %}
@@ -101,6 +102,7 @@
Made with StaticGalleryBuilder by Flo Greistorfer.
+
{%- endif %}
{% if images %}
@@ -150,10 +152,8 @@
var re = /pid=(\d+)/;
function openSwipe(img) {
- // define options (if needed)
var options = {
- // optionName: 'option value'
- index: img // start at first slide
+ index: img
};
var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
gallery.init();
@@ -163,6 +163,23 @@
var pid = window.location.href.match(re)[1];
openSwipe(parseInt(pid));
}
+
+ let totopbutton = document.getElementById("totop");
+
+ window.onscroll = function () { scrollFunction() };
+
+ function scrollFunction() {
+ if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
+ totopbutton.style.display = "block";
+ } else {
+ totopbutton.style.display = "none";
+ }
+ }
+
+ function topFunction() {
+ document.body.scrollTop = 0;
+ document.documentElement.scrollTop = 0;
+ }
{%- endif %}