v1.4.1-beta/website
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
var LOGO_INIT = 0;
|
||||
var GET_INIT = 0;
|
||||
function handleSticky() {
|
||||
const logo = document.querySelector('.logo');
|
||||
const logoCircle = document.querySelector('.logo-circle');
|
||||
if (window.scrollY >= LOGO_INIT) {
|
||||
const get = document.querySelector('.landing .link-button');
|
||||
if (window.scrollY >= LOGO_INIT + logo.offsetHeight) {
|
||||
logo.classList.add('stickied');
|
||||
logoCircle.classList.add('stickied');
|
||||
} else {
|
||||
logo.classList.remove('stickied');
|
||||
logoCircle.classList.remove('stickied');
|
||||
}
|
||||
if (window.scrollY >= GET_INIT + get.offsetHeight) {
|
||||
get.classList.add('stickied');
|
||||
} else {
|
||||
get.classList.remove('stickied');
|
||||
}
|
||||
}
|
||||
window.onload = function () {
|
||||
LOGO_INIT = document.querySelector('.logo').offsetTop;
|
||||
GET_INIT = document.querySelector('.landing .link-button').offsetTop;
|
||||
window.addEventListener('scroll', this.handleSticky);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user