• pallavi

    (@pallavichanodia)


    Hi,

    I do not want to lazy load images which are above the fold. Can anybody help with this ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter pallavi

    (@pallavichanodia)

    Hi,

    Can anybody help with this ? Lazy loading class should not get applied for above the fold images

    Was just about to suggest this. Love the plugin but it visually *adds* loading time because the first post thumbnail in Archives is loaded. I can disable “post thumbnails” which is perfect for post pages, but then Archives load a bunch of unnecessary images.

    Being able to just avoid lazy loading the very first Post Thumbnail found on the page would pretty much solve my issues with it.

    Has anyone edited this plugin or made their own JS/function to make this possible?

    Well I have half of what I wanted. Here’s what I did in my theme’s template-tags.php (in a modified twentysixteen theme)

    if ( is_singular() ) :
    	?>
    
    	<div class="post-thumbnail">
    		<?php the_post_thumbnail('post-thumbnail', array('class' => 'no-lazy')); ?>
    	</div>
    

    Basically just apply the class if it’s a singular post (‘post-thumbnail’ is the thumbnail size my theme’s posts use, it might be different for you).

    I’m stuck on trying to apply it to only the first post on a multi-post page (archives etc). I need to get the post count inside of twentysixteen_post_thumbnail() and I’m not sure what to do beyond add a Count variable from The Loop and pass it all the way down to twentysixteen_post_thumbnail(). Which is probably just what I’m going to do.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Do not lazy load above the fold’ is closed to new replies.