v1.2.0-beta/website brands
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user