mirror of https://github.com/4xmen/xshop.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.0 KiB
JavaScript
31 lines
1.0 KiB
JavaScript
const scrollBreakpoint = window.innerHeight * 0.2;
|
|
let fixmenu = function () {
|
|
try {
|
|
if (window.scrollY > scrollBreakpoint){
|
|
document.querySelector('.HomayonMenu').classList.add('fix');
|
|
document.querySelector('.HomayonMenu').querySelector('.homayon-middle').classList.remove('container');
|
|
}else{
|
|
document.querySelector('.HomayonMenu').classList.remove('fix')
|
|
document.querySelector('.HomayonMenu').querySelector('.homayon-middle').classList.add('container');
|
|
}
|
|
} catch {
|
|
}
|
|
|
|
}
|
|
window.addEventListener('scroll',fixmenu);
|
|
|
|
|
|
fixmenu();
|
|
const toggleSideMenu = function (e) {
|
|
e.preventDefault();
|
|
if (document.querySelector('.homayon-resp-menu').style.display == 'none'){
|
|
document.querySelector('.homayon-resp-menu').style.display = 'block';
|
|
}else{
|
|
document.querySelector('.homayon-resp-menu').style.display = 'none';
|
|
}
|
|
};
|
|
document.addEventListener('DOMContentLoaded',function () {
|
|
document.querySelector('#homa-toggle-menu')?.addEventListener('click',toggleSideMenu);
|
|
});
|
|
|