Support » Plugin: Lazy Loader » Using the plugin without CSS and JS

  • Resolved Bene

    (@bene-2)


    Hi there!

    Is it possible to use this plugin in order just to convert the markup of my images and videos? I need to use another Lazy Javascript so I just need the markup converting function.

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    Hi @-bene-,

    yes, you would need to dequeue and deregister the script (and style, if you want) from the plugin. Something like this should deregister all scripts that are (depending on the activated options) loaded by Lazy Loader:

    function your_slug_plugin_scripts_styles() {
    	wp_dequeue_script( 'lazysizes-aspectratio' );
    	wp_deregister_script( 'lazysizes-aspectratio' );
    
    	wp_dequeue_script( 'lazysizes-native-loading' );
    	wp_deregister_script( 'lazysizes-native-loading' );
    
    	wp_dequeue_script( 'lazysizes-unveilhooks' );
    	wp_deregister_script( 'lazysizes-unveilhooks' );
    
    	wp_dequeue_script( 'lazysizes' );
    	wp_deregister_script( 'lazysizes' );
    }
    
    add_action( 'wp_enqueue_scripts', 'your_slug_plugin_scripts_styles', 11 );

    I described how to modify the inline styles in the FAQ: https://wordpress.org/plugins/lazy-loading-responsive-images/#faq

    Overwriting the style for disabled JS (https://github.com/florianbrinkmann/lazy-loading-responsive-images/blob/master/src/Plugin.php#L810) would be a little more complicated, if you do not want it, the easiest way would be to overwrite it with other CSS rules.

    Hope that helps!
    Florian

    Thanks, I had to change the priority of the add_action to 99 instead of 11 and this is working now! 🙂

    Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    You’re welcome, great to hear that! 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using the plugin without CSS and JS’ is closed to new replies.