From 6ee03b7ebb179da1e7eb8e65399c5f65ba277c15 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sat, 22 May 2021 23:47:34 +0200 Subject: [PATCH] top computed --- .../AccompanyingCourse/components/StickyNav.vue | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue index 7b7486b81..e97738aa3 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue @@ -53,7 +53,8 @@ export default { bannerName: document.querySelector("#header-accompanying_course-name"), bannerDetails: document.querySelector("#header-accompanying_course-details"), stickyNav: null, - sumBanner: null + sumBanner: null, + top: null } }, computed: { @@ -61,34 +62,28 @@ export default { return this.$store.state.accompanyingCourse }, top() { - //return window.getComputedStyle(this.stickyNav).getPropertyValue('top'); // - return 30; //px + return parseInt(window.getComputedStyle(this.stickyNav).getPropertyValue('top').slice(0, -2)); }, - //sumBanner() { - // return this.header.offsetHeight + this.bannerName.offsetHeight + this.bannerDetails.offsetHeight; - //} }, mounted() { this.ready(); - window.addEventListener('scroll', this.handleScroll); // scroll de la souris + window.addEventListener('scroll', this.handleScroll); }, destroyed() { - window.removeEventListener('scroll', this.handleScroll); // scroll de la souris + window.removeEventListener('scroll', this.handleScroll); }, methods: { ready() { + // when mounted ready this.stickyNav = document.querySelector('#navmap'); this.sumBanner = this.header.offsetHeight + this.bannerName.offsetHeight + this.bannerDetails.offsetHeight; const resizeObserver = new ResizeObserver(entries => { // FF/Chrome! console.log('header', this.header.offsetHeight); - //this.header = this.header.offsetHeight; console.log('bannerName', this.bannerName.offsetHeight); - //this.bannerName = this.bannerName.offsetHeight; console.log('bannerDetails', this.bannerDetails.offsetHeight); - //this.bannerDetails = this.bannerDetails.offsetHeight; this.sumBanner = this.header.offsetHeight + this.bannerName.offsetHeight + this.bannerDetails.offsetHeight; console.log('sum', this.sumBanner);