抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

网上、书上的运维技巧整理

Q(old, rect)) { spaced.set(el, rect); el.style["contain-intrinsic-size"] = `${rect.width}px ${rect.height}px`; } }; let iObs = new IntersectionObserver( (entries, o) => { entries.forEach((entry) => { // We don't care if the element is intersecting or // has been laid out as our page structure ensures // they'll get the right width. reserveSpace(entry.target, entry.boundingClientRect); }); }, { rootMargin: "500px 0px 500px 0px" } ); let rObs = new ResizeObserver((entries, o) => { entries.forEach((entry) => { reserveSpace(entry.target, entry.contentRect); }); }); let resizeResilientDeferredRendering = (Selector) => { let articles = document.querySelectorAll(Selector); if (articles.length) { articles.forEach((el) => { iObs.observe(el); rObs.observe(el); }); // Workaround for Chrome bug, part 2. // // Re-enable browser management of rendering for the // first article after the first paint. Double-rAF // to ensure we get called after a layout. requestAnimationFrame(() => { requestAnimationFrame(() => { articles[0].style["content-visibility"] = "auto"; }); }); } }; let contentVisibilityScrollFix = () => { if (!("content-visibility" in document.documentElement.style)) { return; } resizeResilientDeferredRendering(".post-story"); }; contentVisibilityScrollFix(); volantis.pjax.push(contentVisibilityScrollFix); } catch (error) { console.log(error); }