v1.2.0-beta/website brands

This commit is contained in:
2020-05-22 15:58:24 -04:00
parent c373b6e365
commit 32fb08d61e
11 changed files with 261 additions and 36 deletions
+9 -18
View File
@@ -1,20 +1,11 @@
function handleSticky() {
if (window.scrollY >= window.innerHeight * 0.65) {
document.querySelector('header').setAttribute('data-header-visible', true);
} else {
document.querySelector('header').setAttribute('data-header-visible', false);
}
}
window.onload = function () {
let originalTitlePosition = null;
window.addEventListener('scroll', function (ev) {
const title = document.getElementsByClassName('title')[0];
const support = document.getElementsByClassName('support')[0];
const request = document.getElementsByClassName('request')[0];
if (originalTitlePosition === null) originalTitlePosition = title.offsetTop;
if (window.scrollY > originalTitlePosition) {
support.classList.add('stickied');
title.classList.add('stickied');
request.classList.add('stickied');
request.style.right = support.clientWidth + 64 + 'px';
} else {
support.classList.remove('stickied');
title.classList.remove('stickied');
request.classList.remove('stickied');
}
});
this.handleSticky();
window.addEventListener('scroll', this.handleSticky);
};