Wordpress LScache Plugin: LiteSpeed lazyload : is there an equivalent to rootMargin ?
Last Updated on: Wed, 15 Apr 2026 00:00:02 Hi, Follow up to this feed, is it possible to preload images and iframes before they enter into the screen ? With the Intersection Observer API, you can do so by setting a rootMargin parameter so that loading is triggered before the lazy-loaded elements enters the screen. Does the litespeed plugin allows that ? how ? Thank you for help. Best regards, Edit : To complete, here is what Ive found : rootMargin is defined in js/lazyload.lib.js by : rootMargin:t.thresholds||t.threshold+ px So, I guess my question can also be interpreted as : where can I set the t.threshold value ? Thank you This topic was modified 4 months, 3 weeks ago by mxcrml. This topic was modified 4 months, 3 weeks ago by mxcrml. The page I need help with: https://www.astralrank.com What you want to do is paradox. You want to preload a source, but the affected source should als be lazyloaded. You can preload whatever source, but preloading makes lazy loading obsolete, so you may explain what your target is? Maybe there is another way to solve what you are looking for?! You can see threshold: 300, from litespeed-cache/assets/js/lazyload.lib.js L35. @CacheCrawler Hi! Thank you for your answer, I understand your point and my English might not be good enough to express this subtility? I do want the elements (images, iframes, etc.) to lazyload (meaning that they do not load instantaneously with the page load but later on when the user scrolls to reach the element) but the loading should trigger some pixels before the element enters the screen. As @hailite mentioned it, the loading currently triggers 300px before the elements enters the screen. Or at least, t.300px. @hailite Hi ! Thank you for your answer too. Ive seen that indeed, although this value is a bit small for me. On my website, I want the elements to smoothly comes over the clouds for a nice visual effect. It works fine if I scroll slowly but if the scroll is a bit faster, some images appear too late. I think that I need threshold: 600 or even threshold: 900 to be safe. Is that possible ? If not, is there a way I can rewrite the formula of rootMargin to increase it by a factor x even though threshold: 300 remains constant ? What value is the factor t and can I change its value ? To both of you, thank you for your help. Hi, Hope youre doing well in those crazy times? any heads up on how could I configure the threshold or the t-factor ? Thanks
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference