• Resolved mxcrml

    (@mxcrml)


    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 I’ve 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 2 years, 8 months ago by mxcrml.
    • This topic was modified 2 years, 8 months ago by mxcrml.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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?!

    • This reply was modified 2 years, 8 months ago by serpentdriver.
    Plugin Support Hai Zheng?

    (@hailite)

    You can see threshold: 300, from litespeed-cache/assets/js/lazyload.lib.js L35.

    Thread Starter mxcrml

    (@mxcrml)

    @serpentdriver 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. I’ve 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.

    • This reply was modified 2 years, 8 months ago by mxcrml.
    Thread Starter mxcrml

    (@mxcrml)

    Hi,

    Hope you’re doing well in those crazy times… any heads up on how could I configure the threshold or the t-factor ?

    Thanks ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘LiteSpeed lazyload : is there an equivalent to rootMargin ?’ is closed to new replies.