top computed

This commit is contained in:
Mathieu Jaumotte 2021-05-22 23:47:34 +02:00
parent 1217578202
commit 6ee03b7ebb

View File

@ -53,7 +53,8 @@ export default {
bannerName: document.querySelector("#header-accompanying_course-name"), bannerName: document.querySelector("#header-accompanying_course-name"),
bannerDetails: document.querySelector("#header-accompanying_course-details"), bannerDetails: document.querySelector("#header-accompanying_course-details"),
stickyNav: null, stickyNav: null,
sumBanner: null sumBanner: null,
top: null
} }
}, },
computed: { computed: {
@ -61,34 +62,28 @@ export default {
return this.$store.state.accompanyingCourse return this.$store.state.accompanyingCourse
}, },
top() { top() {
//return window.getComputedStyle(this.stickyNav).getPropertyValue('top'); // return parseInt(window.getComputedStyle(this.stickyNav).getPropertyValue('top').slice(0, -2));
return 30; //px
}, },
//sumBanner() {
// return this.header.offsetHeight + this.bannerName.offsetHeight + this.bannerDetails.offsetHeight;
//}
}, },
mounted() { mounted() {
this.ready(); this.ready();
window.addEventListener('scroll', this.handleScroll); // scroll de la souris window.addEventListener('scroll', this.handleScroll);
}, },
destroyed() { destroyed() {
window.removeEventListener('scroll', this.handleScroll); // scroll de la souris window.removeEventListener('scroll', this.handleScroll);
}, },
methods: { methods: {
ready() { ready() {
// when mounted ready
this.stickyNav = document.querySelector('#navmap'); this.stickyNav = document.querySelector('#navmap');
this.sumBanner = this.header.offsetHeight + this.bannerName.offsetHeight + this.bannerDetails.offsetHeight; this.sumBanner = this.header.offsetHeight + this.bannerName.offsetHeight + this.bannerDetails.offsetHeight;
const resizeObserver = new ResizeObserver(entries => { // FF/Chrome! const resizeObserver = new ResizeObserver(entries => { // FF/Chrome!
console.log('header', this.header.offsetHeight); console.log('header', this.header.offsetHeight);
//this.header = this.header.offsetHeight;
console.log('bannerName', this.bannerName.offsetHeight); console.log('bannerName', this.bannerName.offsetHeight);
//this.bannerName = this.bannerName.offsetHeight;
console.log('bannerDetails', this.bannerDetails.offsetHeight); console.log('bannerDetails', this.bannerDetails.offsetHeight);
//this.bannerDetails = this.bannerDetails.offsetHeight;
this.sumBanner = this.header.offsetHeight + this.bannerName.offsetHeight + this.bannerDetails.offsetHeight; this.sumBanner = this.header.offsetHeight + this.bannerName.offsetHeight + this.bannerDetails.offsetHeight;
console.log('sum', this.sumBanner); console.log('sum', this.sumBanner);