• Resolved ksvgn2018

    (@ksvgn2018)


    In my template I got some elements with background images that are defined in the stylesheet. I would like to have them lazy loaded but it doesn’t work automatically. Is there a CSS class I can add that processes these elements with Smush like in this plugin for jQuery?

    https://jquery.eisbehr.de/lazy/

    Since I’m using Smush I would like to avoid installing a second lazy loading plugin.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @ksvgn2018,

    I’m afraid, Smush doesn’t support lazyloading images added via CSS. Is that what you are referring to by the stylesheet?

    Smush can only lazyload images added via img tag, for example:

    <img src="image-one.jpg" />

    As long the images are added via img tags they should get lazyloaded. The classes it supports will only work inside the img tags as an attribute ie

    <img class="lazyloaded" src="image.jpg">

    Please do let us know if you have any further queries.

    Best Regards,

    Nithin

    Thread Starter ksvgn2018

    (@ksvgn2018)

    I was referring to an external stylesheet, yes. In your docs it says:

    The Smush CDN will serve background images using the following methods:

    https://wpmudev.com/docs/wpmu-dev-plugins/smush/
    <img src="imagepath/image.jpg" />
    or
    <div style="background-image: url(imagepath/image.jpg);">Something</div>
    or
    <div class="my-class">Something</div>
    <style>.my-class { background-image: url(imagepath/image.jpg); }</style>

    So it works with inline styles – not only for images but also for elements with a defined background image?

    Plugin Support Jair – WPMU DEV Support

    (@wpmudevsupport15)

    Hi @ksvgn2018,

    I hope you are doing well today!

    According to the documentation section you are referring, it seems there is a confusion here between Lazy Loading feature and Smush CDN as they are two different features and Smush CDN is only available for the Pro version of the plugin.

    https://wpmudev.com/docs/wpmu-dev-plugins/smush/#cdn

    Kind regards,
    Zafer

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @ksvgn2018 ,

    We haven’t heard from you for over 2 weeks now, so it seems that you don’t have more questions for us.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘CSS class for lazy loading in template?’ is closed to new replies.