diff --git a/README.md b/README.md index d221f5e..61d8296 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ - actions: - "from selection" - ~~Gallery: drag-n-drop~~ - - ~~drop files/images~~ -- add loading indicator + - ~~drop files/images~~ - ~~drag to sort~~ - **drag marked** - touch... diff --git a/css/grid-n-view.css b/css/grid-n-view.css index f6344ce..f366f05 100644 --- a/css/grid-n-view.css +++ b/css/grid-n-view.css @@ -84,6 +84,8 @@ body { .gallery { --base-layer: 10; + position: relative; + padding-top: var(--gallery-padding-top); padding-bottom: var(--gallery-padding-bottom); padding-left: calc( @@ -93,6 +95,7 @@ body { color: var(--gallery-text-color); background: var(--gallery-background-color); + font-family: sans-serif; overflow-x: clip; } @@ -580,6 +583,49 @@ body { +/********************************************************* Splash ****/ + +.gallery .loading { + position: absolute; + display: block; + + top: 0; + left: 0; + width: 100%; + height:100%; + + text-align: center; + + z-index: calc(var(--base-layer) * 2); + + background: white; +} +.gallery.ready .loading { + animation: fadeOutAnimation ease 2s; + animation-iteration-count: 1; + animation-fill-mode: forwards; + pointer-events: none; +} +@keyframes fadeOutAnimation { + 0% { + opacity: 1; + } + 100% { + opacity: 0; + visibility: hidden; + } +} + +.gallery.ready .loading * { + display: none; +} +.gallery:not(.ready) .images img { + visibility: hidden; +} + + + + /********************************************************** Utils ****/ .gallery:not(.lightboxed):not(.detailed) .hide-in-gallery, @@ -588,6 +634,40 @@ body { display: none; } +/* loading animation... */ +.gallery .loading>div { + --bar-size: 0.2rem; + + position: sticky; + top: var(--bar-size); +} +.gallery .loading>div:before, +.gallery .loading>div:after { + content: ""; + position: absolute; + top: calc(var(--bar-size) * -1); + left: 0; + width: 100%; + height: var(--bar-size); + opacity: 0.3; +} +.gallery .loading>div:after { + background: gray; + animation: loadingBarAnimation ease infinite alternate 2s; +} +.gallery .loading>div:before { + width: 50%; + background: gray; + animation: loadingBarAnimation ease infinite alternate 1.5s; +} +@keyframes loadingBarAnimation { + 0% { + translate: -100%; + } + 100% { + translate: 100%; + } +} /********************************************************************** diff --git a/grid-n-view.html b/grid-n-view.html index d116ded..b710a27 100644 --- a/grid-n-view.html +++ b/grid-n-view.html @@ -16,7 +16,7 @@ body.splash { } /* fade-in body... */ -/* XXX add real splash screen... */ +/* XXX add real splash screen... body:not(.splash) { animation: fadeInAnimation ease 2s; animation-iteration-count: 1; @@ -31,6 +31,7 @@ body:not(.splash) { opacity: 1; } } +*/