From 8bc3fcd1091660c3dea42d4045b7d0b3e6a9b510 Mon Sep 17 00:00:00 2001 From: chme Date: Wed, 7 Oct 2020 09:03:02 +0200 Subject: [PATCH] [web-src] Refine hide/show index lists --- web-src/src/main.js | 4 ++ web-src/src/mystyles.scss | 5 ++ web-src/src/templates/ContentWithHeading.vue | 60 +++++++++++++++----- 3 files changed, 54 insertions(+), 15 deletions(-) diff --git a/web-src/src/main.js b/web-src/src/main.js index 9c3d5fac..cf6eca58 100644 --- a/web-src/src/main.js +++ b/web-src/src/main.js @@ -8,6 +8,8 @@ import './filter' import './progress' import vClickOutside from 'v-click-outside' import VueTinyLazyloadImg from 'vue-tiny-lazyload-img' +import VueObserveVisibility from 'vue-observe-visibility' +import VueScrollTo from 'vue-scrollto' import 'mdi/css/materialdesignicons.css' import 'vue-range-slider/dist/vue-range-slider.css' import './mystyles.scss' @@ -15,6 +17,8 @@ Vue.config.productionTip = false Vue.use(vClickOutside) Vue.use(VueTinyLazyloadImg) +Vue.use(VueObserveVisibility) +Vue.use(VueScrollTo) /* eslint-disable no-new */ new Vue({ diff --git a/web-src/src/mystyles.scss b/web-src/src/mystyles.scss index 334b2725..ea7822ab 100644 --- a/web-src/src/mystyles.scss +++ b/web-src/src/mystyles.scss @@ -115,6 +115,11 @@ section.hero + section.fd-content { box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); } +/* Set minimum height to hide "option" section */ +.fd-content-with-option { + min-height: calc(100vh - 3.25rem - 3.25rem - 8rem); +} + /* Now playing page */ .fd-is-fullheight { height: calc(100vh - 3.25rem - 3.25rem); diff --git a/web-src/src/templates/ContentWithHeading.vue b/web-src/src/templates/ContentWithHeading.vue index 5aea4bf1..9e5fdb5f 100644 --- a/web-src/src/templates/ContentWithHeading.vue +++ b/web-src/src/templates/ContentWithHeading.vue @@ -4,29 +4,34 @@
+
- + + +
+
- - -
-
@@ -38,9 +43,34 @@ export default { name: 'ContentWithHeading', + data () { + return { + options_visible: false, + observer_options: { + callback: this.visibilityChanged, + intersection: { + rootMargin: '-100px' + } + } + } + }, + methods: { scroll_to_top: function () { window.scrollTo({ top: 0, behavior: 'smooth' }) + }, + + scroll_to_content: function () { + // window.scrollTo({ top: 80, behavior: 'smooth' }) + if (this.$route.meta.has_tabs) { + this.$scrollTo('#top', { offset: -140 }) + } else { + this.$scrollTo('#top', { offset: -100 }) + } + }, + + visibilityChanged: function (isVisible) { + this.options_visible = isVisible } } }