sure, you’re allowed to do anything you want on your own site V.E.L 🙂
Thread Starter
V.E.L
(@vezraimanuel)
@optimizingmatters
Thanks!!
this is what i did:
add_filter( 'autoptimize_filter_imgopt_lazyload_cssoutput', '__return_false' );
add_action( 'wp_head', function() { echo '<style>.lazyload,.lazyloading{opacity:0;}.lazyloaded{opacity:1;transition:opacity 300ms;}</style>'; }, 2147483647 );
please let me know if you have suggestion about how to do it properly.
many thanks!
-
This reply was modified 6 years, 10 months ago by
V.E.L.
I would suggest doing something like
add_filter( 'autoptimize_filter_imgopt_lazyload_cssoutput', 'nonoscript_lazyload');
function nonoscript_lazyload($in) {
return str_replace( '<noscript><style>.lazyload{display:none;}</style></noscript>', '', $in ) ;
}
warning: didn’t test this (no time now), but you’ll get the idea 😉
frank
Thread Starter
V.E.L
(@vezraimanuel)
Hi @optimizingmatters
thanks! that works too
but i had to remove autoptimize_filter_imgopt_lazyload_cssoutput and add the style to <head> because W3C validator returns error when we load <style> inside body
many thanks!, cheers 😀