diff options
author | amazingrise <8315221+AmazingRise@users.noreply.github.com> | 2019-11-22 16:30:28 +0300 |
---|---|---|
committer | amazingrise <8315221+AmazingRise@users.noreply.github.com> | 2019-11-22 16:30:28 +0300 |
commit | 3b517cf4a58e56ce7582f311b4df65b096ee9172 (patch) | |
tree | e9fb28a92bd7199cd1cd4f8cacfe28eae2a0b29c /static | |
parent | 999e81b8105a5eda4a1bdca61afbb204ebbb397f (diff) |
Introduce journal.js successfully.
Diffstat (limited to 'static')
-rw-r--r-- | static/js/journal.js | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/static/js/journal.js b/static/js/journal.js index 39c2c9a..50927c6 100644 --- a/static/js/journal.js +++ b/static/js/journal.js @@ -9,41 +9,41 @@ app = new Vue({ mounted: false, }, methods: { - sgn(t, x) { - let k = 1. / (1. - 2 * t); - if (x <= t) return 0; - else if (x >= 1 - t) return 1; - else { - return k * (x - t); - } - }, - handleScroll() { - this.scrollY = window.scrollY; - this.navOpacity = this.sgn(.0, Math.min(1, Math.max(0, window.scrollY / (this.pageHeadHeight() - this.navBarHeight() * 0.8)))); - const {navBar, navBackground, navTitle, extraContainer, streamContainer} = this.$refs; + sgn(t, x) { + let k = 1. / (1. - 2 * t); + if (x <= t) return 0; + else if (x >= 1 - t) return 1; + else { + return k * (x - t); + } + }, + handleScroll() { + this.scrollY = window.scrollY; + this.navOpacity = this.sgn(.0, Math.min(1, Math.max(0, window.scrollY / (this.pageHeadHeight() - this.navBarHeight() * 0.8)))); + const {navBar, navBackground, navTitle, extraContainer, streamContainer} = this.$refs; - if (this.navOpacity >= 1) { - navBackground.style.opacity = 1; - navTitle.style.opacity = 1; - } else { - navBackground.style.opacity = 0; - navTitle.style.opacity = 0; - } - }, - handleResize() { - const {navBar, navBackground, navTitle, extraContainer, streamContainer} = this.$refs; - extraContainer.style.left = (streamContainer.offsetWidth - extraContainer.offsetWidth) + 'px'; - }, - navBarHeight() { - return this.$refs.navBar.offsetHeight; - }, - pageHeadHeight() { - return this.$refs.pageHead.offsetHeight; - }, - toggleDrawer() { - this.isDrawerOpen = !this.isDrawerOpen; - document.getElementsByTagName('html')[0].style.overflow = this.isDrawerOpen ? 'hidden' : 'unset'; - }, + if (this.navOpacity >= 1) { + navBackground.style.opacity = 1; + navTitle.style.opacity = 1; + } else { + navBackground.style.opacity = 0; + navTitle.style.opacity = 0; + } + }, + handleResize() { + const {navBar, navBackground, navTitle, extraContainer, streamContainer} = this.$refs; + extraContainer.style.left = (streamContainer.offsetWidth - extraContainer.offsetWidth) + 'px'; + }, + navBarHeight() { + return this.$refs.navBar.offsetHeight; + }, + pageHeadHeight() { + return this.$refs.pageHead.offsetHeight; + }, + toggleDrawer() { + this.isDrawerOpen = !this.isDrawerOpen; + document.getElementsByTagName('html')[0].style.overflow = this.isDrawerOpen ? 'hidden' : 'unset'; + }, }, created() { window.addEventListener('scroll', this.handleScroll); |