WordPress.org

Support

Support » Plugins and Hacks » [lazy load] images loaded via ajax not loading at all

[lazy load] images loaded via ajax not loading at all

  • I tried rerunning the script in the plugin after the ajax load runs but it doesn’t help. is there any way to selectively disable lazy loading?

Viewing 1 replies (of 1 total)
  • ok, I figured out one way to get around this, though it’s not my favorite solution. The image loaded in my ajax has a specific class.

    I simply added this:
    if(!strpos($content,’image-class-name’))
    before this:
    $content = preg_replace( ‘#<img([^>]+?)src=[\'”]([^\'”>]*)[\'”]([^>]*)>#’, sprintf( ‘<img${1}src=”%s” data-lazy-src=”${2}”${3}><noscript><img${1}src=”${2}”${3}></noscript>’, $placeholder_image ), $content );

    I wish this image could be lazy loaded as well, but it’s not a big deal since it doesn’t impact the page load time.

Viewing 1 replies (of 1 total)
  • The topic ‘[lazy load] images loaded via ajax not loading at all’ is closed to new replies.