2024-01-17 20:42:02 +01:00
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
|
|
const wrapper = document.querySelector('.wrapper');
|
|
|
|
const loginLink = document.querySelector('.login-link');
|
|
|
|
const registerLink = document.querySelector('.register-link');
|
|
|
|
const btnPopup = document.querySelector('.btnLogin-popup');
|
|
|
|
const iconClose = document.querySelector('.icon-close');
|
2024-01-15 13:00:11 +01:00
|
|
|
|
2024-01-17 20:42:02 +01:00
|
|
|
function openLoginForm(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
event.stopPropagation();
|
|
|
|
wrapper.classList.add('active-popup');
|
|
|
|
}
|
2024-01-15 13:00:11 +01:00
|
|
|
|
2024-01-17 20:42:02 +01:00
|
|
|
function closeLoginForm(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
event.stopPropagation();
|
|
|
|
wrapper.classList.remove('active-popup');
|
|
|
|
}
|
2024-01-15 13:00:11 +01:00
|
|
|
|
2024-01-17 20:42:02 +01:00
|
|
|
registerLink.addEventListener('click', function (event) {
|
|
|
|
openLoginForm(event);
|
|
|
|
wrapper.classList.add('active');
|
|
|
|
});
|
|
|
|
|
|
|
|
loginLink.addEventListener('click', function (event) {
|
|
|
|
openLoginForm(event);
|
|
|
|
wrapper.classList.remove('active');
|
|
|
|
});
|
|
|
|
|
|
|
|
btnPopup.addEventListener('click', openLoginForm);
|
2024-01-15 13:00:11 +01:00
|
|
|
|
2024-01-17 20:42:02 +01:00
|
|
|
iconClose.addEventListener('click', closeLoginForm);
|
2024-01-15 13:00:11 +01:00
|
|
|
});
|
|
|
|
|
2024-01-17 20:42:02 +01:00
|
|
|
window.addEventListener('scroll', function() {
|
|
|
|
var headerPlaceholder = document.querySelector('.header-placeholder');
|
|
|
|
var header = document.querySelector('header');
|
|
|
|
|
|
|
|
if (window.scrollY >= header.offsetTop) {
|
|
|
|
headerPlaceholder.style.display = 'block';
|
|
|
|
} else {
|
|
|
|
headerPlaceholder.style.display = 'none';
|
|
|
|
}
|
2024-01-18 11:24:52 +01:00
|
|
|
});
|
|
|
|
|