Jump to content
  • Our Picks

    Repair headsets from different manufacturers

    Repair of telephone exchanges and equipment

    Repair of intercom systems and equipment

    Remove Render-blocking CSS

    We are repairing different inverters

  • Vote for us

Defer images combined


Nophelet

Recommended Posts

  • Owner

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
Share on other sites

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

×
×
  • Create New...