better display
This commit is contained in:
parent
17332c1621
commit
0d2ef223c4
2 changed files with 7 additions and 2 deletions
|
|
@ -227,7 +227,7 @@ abbr {
|
|||
display: block;
|
||||
background-attachment: fixed;
|
||||
background-position: center;
|
||||
background-size: contain;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
iframe {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue