add optimizeSpeed image-rendering attr, formatting

This commit is contained in:
Tomáš Mládek 2021-01-09 21:00:30 +01:00
parent 4531d12671
commit fee57e4b3b

View file

@ -36,11 +36,11 @@ export default defineComponent({
onMounted(() => { onMounted(() => {
const observer = new IntersectionObserver((entries, observer) => { const observer = new IntersectionObserver((entries, observer) => {
entries.forEach((entry) => { entries.forEach((entry) => {
if (entry.isIntersecting){ if (entry.isIntersecting) {
const element = entry.target as HTMLImageElement; const element = entry.target as HTMLImageElement;
element.src = element.dataset.src!; element.src = element.dataset.src!;
} }
}) });
}, {rootMargin: "100px"}); }, {rootMargin: "100px"});
Array.from((root.value as Element).children).forEach((el) => { Array.from((root.value as Element).children).forEach((el) => {
observer.observe(el); observer.observe(el);
@ -84,9 +84,6 @@ function getMeta(url: string): Promise<HTMLImageElement> {
<style scoped> <style scoped>
.video-scroll img { .video-scroll img {
position: absolute; position: absolute;
} image-rendering: optimizeSpeed;
.initial {
background: red;
} }
</style> </style>