Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable lazy load on child elements #21

Open
kalnode opened this issue Oct 6, 2019 · 0 comments
Open

Disable lazy load on child elements #21

kalnode opened this issue Oct 6, 2019 · 0 comments

Comments

@kalnode
Copy link

kalnode commented Oct 6, 2019

Your existing helper scripts are great! Thanks.

In the case of disable-lazy-loading-by-class...

function rocket_lazyload_exclude_class( $attributes ) {
	$attributes[] = 'class="divi-slider"';

	return $attributes;
}
add_filter( 'rocket_lazyload_excluded_attributes', 'rocket_lazyload_exclude_class' );

... sometimes you cannot access the class of the element directly.

For example, I'm trying to disable lazy loading on a specific background video generated by another plugin (a page builder). Using just the available page builder interface, I can control the class of the container, but no deeper than that.

The page builder generates a video instance like so, and I'm having trouble disabling lazy loading for the video specifically:


<div class="i_can_control_this">

    <!-- I don't have control over the child elements below. Either <video> or <source> (?) needs to have a class in order to target and disable lazy loading. -->

    <div class="section_video">
        <div class="mask"></div>
        <video poster="" autoplay="true" loop="true" muted="muted">
            <source type="video/mp4" src="https://mywebsite.com/wp-content/uploads/2019/10/bg-video.m4v">
        </video>
    </div>

</div>

It would be helpful if another helper was put together that allowed more advanced CSS targeting than simply by class alone. Like class + tag (".lazy-disable video").

@kalnode kalnode changed the title Disable lazy load using more advanced css selectors Disable lazy load on child elements Oct 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant