Support » Plugin: Lazy Load » How to apply new lazy loading filter?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mohammad Jangda

    (@batmoo)

    Check out this example for disabling the plugin for mobile browsers (when using Jetpack): https://github.com/Automattic/lazy-load/blob/master/wpcom-helper.php

    If you’re looking to disable for particular posts, it’s not super easy with the current filter but if that’s a use case you’re looking for we could make it work.

    Great, thanks for that Mohammad. In my use case its more that my archives are a Masonry grid, which is doing its imagesLoaded thing… That combined with lazy loading means it miscalculates the absolute positions and heights of some bricks causing all sorts of overlaps.

    So if I do something like this, all should be good?

    <?php
    
    add_filter( 'lazyload_is_enabled', 'let_masonry_do_its_stuff' );
    
    function let_masonry_do_its_stuff( $enabled ) {
    
    	if ( is_archive() )
    		$enabled = false;
    
    	return $enabled;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to apply new lazy loading filter?’ is closed to new replies.