From 155f1af30d94b8d3312804b00fbf51668338b634 Mon Sep 17 00:00:00 2001 From: Zhao Zuohong <1040110848@qq.com> Date: Thu, 20 Oct 2022 19:11:46 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Infinite=20scrolling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layouts/_default/baseof.html | 6 +++ layouts/index.html | 5 ++- layouts/partials/after-content-js.html | 47 ++++++++++++++++++++ layouts/partials/head.html | 5 +++ layouts/partials/loading.html | 8 ++++ static/style/loading.css | 60 ++++++++++++++++++++++++++ 6 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 layouts/partials/loading.html create mode 100644 static/style/loading.css diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index f9ee8a3..c716e0b 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -12,10 +12,16 @@
+ + {{ if not .Site.Params.infiniteScroll }} + + + {{ end }} +
{{ partial "footer.html" . }} diff --git a/layouts/index.html b/layouts/index.html index afea4e7..f6cfa39 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -5,6 +5,9 @@ {{ partial "row.html" . }} {{ end }} + {{ if .Site.Params.infiniteScroll }} + {{ partial "loading.html" . }} + {{ end }} {{ end }} @@ -34,4 +37,4 @@ {{ else }}
Next >
{{ end }} -{{ end }} \ No newline at end of file +{{ end }} diff --git a/layouts/partials/after-content-js.html b/layouts/partials/after-content-js.html index 211ec72..6f1f4d7 100644 --- a/layouts/partials/after-content-js.html +++ b/layouts/partials/after-content-js.html @@ -47,3 +47,50 @@ }); + +{{ if .Site.Params.infiniteScroll }} + +{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 6196c21..795f670 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -44,6 +44,11 @@ + +{{ if .Site.Params.infiniteScroll }} + +{{ end }} + {{/* pangu support: js in the end before the body closing tag */}} {{ if .Site.Params.features.pangu }} diff --git a/layouts/partials/loading.html b/layouts/partials/loading.html new file mode 100644 index 0000000..e54d4f4 --- /dev/null +++ b/layouts/partials/loading.html @@ -0,0 +1,8 @@ +
+
+
+
+
+
+
+
diff --git a/static/style/loading.css b/static/style/loading.css new file mode 100644 index 0000000..12904b3 --- /dev/null +++ b/static/style/loading.css @@ -0,0 +1,60 @@ +.loading-wrapper { + display: none; + justify-content: center; +} + +.lds-ellipsis { + display: inline-block; + position: relative; + width: 80px; + height: 80px; +} +.lds-ellipsis div { + position: absolute; + top: 33px; + width: 10px; + height: 10px; + border-radius: 50%; + background: #ccc; + animation-timing-function: cubic-bezier(0, 1, 1, 0); +} +.lds-ellipsis div:nth-child(1) { + left: 8px; + animation: lds-ellipsis1 0.6s infinite; +} +.lds-ellipsis div:nth-child(2) { + left: 8px; + animation: lds-ellipsis2 0.6s infinite; +} +.lds-ellipsis div:nth-child(3) { + left: 32px; + animation: lds-ellipsis2 0.6s infinite; +} +.lds-ellipsis div:nth-child(4) { + left: 56px; + animation: lds-ellipsis3 0.6s infinite; +} +@keyframes lds-ellipsis1 { + 0% { + transform: scale(0); + } + 100% { + transform: scale(1); + } +} +@keyframes lds-ellipsis3 { + 0% { + transform: scale(1); + } + 100% { + transform: scale(0); + } +} +@keyframes lds-ellipsis2 { + 0% { + transform: translate(0, 0); + } + 100% { + transform: translate(24px, 0); + } +}