v.14.1-beta/website redesign
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
var LOGO_INIT = 0;
|
||||
function handleSticky() {
|
||||
if (window.scrollY >= window.innerHeight * 0.65) {
|
||||
document.querySelector('header').setAttribute('data-header-visible', true);
|
||||
const logo = document.querySelector('.logo');
|
||||
const logoCircle = document.querySelector('.logo-circle');
|
||||
if (window.scrollY >= LOGO_INIT) {
|
||||
logo.classList.add('stickied');
|
||||
logoCircle.classList.add('stickied');
|
||||
} else {
|
||||
document.querySelector('header').setAttribute('data-header-visible', false);
|
||||
}
|
||||
if (document.querySelector('.intro')) {
|
||||
const intro = document.querySelector('.intro');
|
||||
intro.style = `--percentIntroScroll : ${window.scrollY / intro.offsetTop - 0.2}`;
|
||||
}
|
||||
if (document.querySelector('.features')) {
|
||||
const features = document.querySelector('.features');
|
||||
features.style = `--percentFeatureScroll : ${window.scrollY / features.offsetTop - 0.4}`;
|
||||
logo.classList.remove('stickied');
|
||||
logoCircle.classList.remove('stickied');
|
||||
}
|
||||
}
|
||||
window.onload = function () {
|
||||
LOGO_INIT = document.querySelector('.logo').offsetTop;
|
||||
window.addEventListener('scroll', this.handleSticky);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user