diff --git a/web/mc-pelican/static/local.css b/web/mc-pelican/static/local.css index e1b97cd..22eaa88 100644 --- a/web/mc-pelican/static/local.css +++ b/web/mc-pelican/static/local.css @@ -227,7 +227,7 @@ abbr { display: block; background-attachment: fixed; background-position: center; - background-size: contain; + background-size: cover; } iframe { diff --git a/web/mc-pelican/static/script.js b/web/mc-pelican/static/script.js index b35890e..9d41a57 100644 --- a/web/mc-pelican/static/script.js +++ b/web/mc-pelican/static/script.js @@ -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; - paras[i].setAttribute("offset", paras[i].getBoundingClientRect().bottom - image.height * 0.5); + 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;