Owner Nophelet Posted March 6, 2019 Owner Share Posted March 6, 2019 If you are using loading images from type "img src=" and the background images on your site, what should you do: - Use image code editing that loads with "img sec=" as described in the article here - Use image code editing that loads with background images as described in the article here - Remove a script if you have already used one or the other method - Place only this script <script> function init() { var imgDefer = document.getElementsByTagName('img'); for (var i=0; i<imgDefer.length; i++) { if(imgDefer[i].getAttribute('dota-src')) { imgDefer[i].setAttribute('src',imgDefer[i].getAttribute('dota-src')); } } $(function(){ $('[data-bg]').each(function(){ var bg = $(this).data('bg'); $(this).css('background-image','url(' + bg + ')'); }); });} window.onload = setTimeout(init, 600); </script> Now all your images will be loaded "onload" Note: If you don't understand these instructions or are looking for help, please contact me. Of course, I will help you, but for a fee. Link to comment https://nophelet.com/consult/topic/188-defer-images-combined/ Share on other sites More sharing options...
Recommended Posts