Support » Plugin: Lazy Load » Change threshold on a spesific i frame

  • Resolved honoluluman

    (@honoluluman)


    Hello,

    Thank you for this great plugin.
    I would like to ask if there is an attribute that i can use to change the lazy load threshold on a specific iframe. Or maybe a filter?

    Thank you very much for your time

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author WP Media

    (@wp_media)

    Hi@honoluluman,

    By default, LazyLoad loads images/iframes that are within 300px of the viewport (browser window). However you can adjust this threshold with the following.

    In this example the threshold is set to 100px:

    function rocket_lazyload_custom_threshold( $threshold ) {
    	return 100;
    }
    add_filter( 'rocket_lazyload_threshold', 'rocket_lazyload_custom_threshold' );

    Replace 100 with your desired value.

    Let us know if you have other questions 🙂

    Bests,

    Romain

    Thread Starter honoluluman

    (@honoluluman)

    hello @wp_media

    Thank you for your fast reply 🙂
    I am already using the code you just provided. My problem is that since i don’t want all of my images/iframes to have the same common threshold, i would like to ask if somehow i could target a specific iframe to have another threshold different than the rest. I really don’t want to disable the lazyloading of that iframe, just to set it different value.

    Thank you for your time

    Plugin Author WP Media

    (@wp_media)

    Hello again @honoluluman!

    The only way to adjust the threshold is globaly.

    By the moment, there isn’t a way to adjust it for a specific element.

    Let us know if you have other questions 🙂

    Bests,

    Sandy

    Thread Starter honoluluman

    (@honoluluman)

    hello @wp_media and thank you for the clarification 🙂

    Another issue that i have is that i am trying to exclude from lazy loading all the youtube thumbnails that are being generated from the plugin but with no luck.

    The reason behind this is that because the images are being lazyloaded , the user is experiencing to see first the youtube play button and after the image. This gives away to the user the functionality of the embedded image and not the embedded video.

    So i tried to do something like that

    function rocket_lazyload_exclude_src( array $src ) {
    	$src[] = 'logo';
    	$src[] = '/i.ytimg.com';
    	return $src;
    }
    add_filter( 'rocket_lazyload_excluded_src', 'rocket_lazyload_exclude_src' );

    but doesn’t seems to work. Any help would be appriciated.

    • This reply was modified 3 months, 1 week ago by honoluluman.
    Plugin Author WP Media

    (@wp_media)

    Hi @honoluluman.

    At the moment it is not possible to exclude the video thumbnail from Lazy Loading and keep the video Lazy loaded at the same time.

    Best Regards,
    Jurica

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.