window.addEventListener('load', () => { wyrownaj1(); }) window.addEventListener('resize', () => { wyrownaj1(); }) function wyrownaj1() { if(screen.width<1925) { console.log(screen.width); var react1= document.querySelector('.ainsta img').getBoundingClientRect(); var react2= document.querySelector('.container-menu ul li a').getBoundingClientRect(); var react3= document.querySelector('.facos').getBoundingClientRect(); var szer=document.querySelector('.container-menu').offsetWidth; document.querySelector('.ajajka').style.setProperty('left',(react1.right-25)+'px','important'); document.querySelector('.ajajka').style.setProperty('top',react2.y+'px','important'); var react4= document.querySelector('.ajajka').getBoundingClientRect().x; var prawa=screen.width-react3.left; document.querySelector('.container-menu').style.setProperty('left',(react3.left-szer)+'px'); }else { document.querySelector('.container-menu').removeAttribute('style'); }}