• WordPress Media & Text Block uses a structure such as follows:

    Parent Container: div.wp-block-media-text
    Child One: figure.wp-block-media-text__media
    Child Two: img needing to skip lazy loading


    Adding the class of ‘skip-lazy’ (or any custom defined class) is applied to the parent DIV. The Media & Text Block does not allow for a way of adding a custom class to just the Media or just the Text.

    I’ve tried brute injecting the class using this jQuery code, but to no success:

    jQuery('div:has(.wp-block-media-text) figure:has(.wp-block-media-text__media) img').addClass('noLazyLoad');	

    Before I go down to much of a rabbit hole, is there an official and simple way of excluding Media & Text Block Images from Lazy Loading. I wish to implement this for Above The Fold Media & Text instances.

    Thank you in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Nguyen Tuan

    (@nguyencongtuan)

    Hi

    With that structure from core bloc then it’s impossible to add exclude class for img tag

    And the cause your script dont work because lazy load is checking exclude class name by PHP before HTML is output on frontend so your javascript will not work

    Hello Nguyen Sir,

    I need help, how do i show popular post base on post view count with the jet-engine plugin. there has any option to do this. i user meta key but it not working. it show random post

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help Request: Media & Text Block Skip Lazy Loading’ is closed to new replies.