Lazy Load not working

Smush Lazy load isn’t working on my theme when it is enabled my images stop to show and I can see this on my source code

https://cdn.livechat-static.com/api/file/v2/lc/att-old/8801096/2cb5a3c62cb1e56dda9097114bc6126e/MarketSmar.png

I would love this to be working on my site, can you help me?

  • Nithin
    • Support Wizard

    Hi Zach,

    Since it’s a staging website, I have created a new super admin account(wpmudevnithin) so that we could access your dashboard with ease.

    I could notice the issue when tested on your website. The latest update of the Smush plugin should have worked for such anomalies noticed, seems like the fix doesn’t seem to work in your website.

    I’m bringing this into our developer’s attention to see what could be causing this and will get back to you once I get further feedback regarding the status of the issue asap.

    Kind Regards,

    Nithin

  • Nithin
    • Support Wizard

    Hi Zach,

    On further troubleshooting, it seems like your theme is adding the following classno-js in the HTML tag via header.php file template.

    The above class is added in order to load CSS with Javascript disabled. Smush detects this, and hence causes the images not load when Lazyload is enabled, as the “no-js” class gives an impression of javascript is disabled.

    I have brought this into the developers attention so that we could check further about what could be done in such use cases out of the box.

    In the mean while, I have added the following code in the staging website, as mu-plugins:

    <?php

    function wpmu_change_js_class() {
    echo '<script>document.documentElement.className = document.documentElement.className.replace("no-js","js");</script>'. "n";
    }
    add_action( 'wp_head', 'wpmu_change_js_class', 1 );

    Which should fix the issue noticed. Please do check, and let us know if you have any further query. Have a nice day ahead.

    Best Regards,

    Nithin

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.