Answers for "jpeg nach und nach laden"

PHP
0

jpeg nach und nach laden

<?php

// Ab hier kopieren
if ( ! function_exists( 'ah_load_defer_images_script' ) ) :
/**
 * Deferring images for faster pages
 */
function ah_load_defer_images_script() {
?>
<script>
function init() {
var imgDefer = document.getElementsByTagName('img');
for (var i=0; i<imgDefer.length; i++) {
if(imgDefer[i].getAttribute('data-src')) {
imgDefer[i].setAttribute('src',imgDefer[i].getAttribute('data-src'));
} } }
window.onload = init;
</script>
<?php }
add_action('wp_footer', 'ah_load_defer_images_script');
endif;
Posted by: Guest on February-03-2021

Browse Popular Code Answers by Language