better display

This commit is contained in:
randogoth 2023-05-03 23:24:05 +03:00
parent 17332c1621
commit 0d2ef223c4
2 changed files with 7 additions and 2 deletions

View file

@ -227,7 +227,7 @@ abbr {
display: block;
background-attachment: fixed;
background-position: center;
background-size: contain;
background-size: cover;
}
iframe {

View file

@ -12,7 +12,12 @@ for (let i = 0; i < paras.length; i++) {
var imageSrc = paras[i].style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi, '$2').split(',')[0];
var image = new Image();
image.src = imageSrc;
if ( screen.width > screen.height ) {
paras[i].setAttribute("offset", paras[i].getBoundingClientRect().bottom - image.height * 0.5);
} else {
paras[i].parentNode.insertBefore(image, paras[i].nextSibling);
paras[i].style.display = 'none';
}
}
window.addEventListener('scroll', () => {
let { scrollY } = window;