mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
cleaning
This commit is contained in:
parent
6ee03b7ebb
commit
4261ddcde4
@ -54,7 +54,7 @@ export default {
|
||||
bannerDetails: document.querySelector("#header-accompanying_course-details"),
|
||||
stickyNav: null,
|
||||
sumBanner: null,
|
||||
top: null
|
||||
limit: 25
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -81,13 +81,12 @@ export default {
|
||||
|
||||
const resizeObserver = new ResizeObserver(entries => { // FF/Chrome!
|
||||
|
||||
console.log('header', this.header.offsetHeight);
|
||||
console.log('bannerName', this.bannerName.offsetHeight);
|
||||
console.log('bannerDetails', this.bannerDetails.offsetHeight);
|
||||
|
||||
//console.log('header', this.header.offsetHeight);
|
||||
//console.log('bannerName', this.bannerName.offsetHeight);
|
||||
//console.log('bannerDetails', this.bannerDetails.offsetHeight);
|
||||
this.sumBanner = this.header.offsetHeight + this.bannerName.offsetHeight + this.bannerDetails.offsetHeight;
|
||||
console.log('sum', this.sumBanner);
|
||||
console.log('--');
|
||||
//console.log('sum', this.sumBanner);
|
||||
//console.log('--');
|
||||
|
||||
});
|
||||
resizeObserver.observe(this.header);
|
||||
@ -97,23 +96,23 @@ export default {
|
||||
},
|
||||
handleScroll(event) {
|
||||
|
||||
//console.log('top !!', this.top);
|
||||
//console.log(this.stickyNav);
|
||||
let pos = this.findPosition(this.stickyNav);
|
||||
//console.log(window.scrollY);
|
||||
console.log('sum2', this.sumBanner);
|
||||
let top = this.sumBanner + this.top - window.scrollY; //pos['y']
|
||||
if (top > 25) {
|
||||
console.log('absolute', pos['y']);
|
||||
//console.log('sum2', this.sumBanner);
|
||||
let top = this.sumBanner + this.top - window.scrollY;
|
||||
if (top > this.limit) {
|
||||
//console.log('absolute', pos['y']);
|
||||
this.stickyNav.style.position = 'absolute';
|
||||
this.stickyNav.style.left = '-60px';
|
||||
} else {
|
||||
console.log('fixed', pos['y']);
|
||||
//console.log('fixed', pos['y']);
|
||||
this.stickyNav.style.position = 'fixed';
|
||||
this.stickyNav.style.left = pos['x'] + 'px';
|
||||
}
|
||||
|
||||
},
|
||||
findPosition(element) {
|
||||
|
||||
let posX = 0, posY = 0;
|
||||
do {
|
||||
posX += element.offsetLeft;
|
||||
|
Loading…
x
Reference in New Issue
Block a user