Jump to content
  • All Servicing

Sign in to follow this  

Defer images combined

Recommended Posts


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

function init() {
var imgDefer = document.getElementsByTagName('img');
for (var i=0; i<imgDefer.length; i++) {
if(imgDefer[i].getAttribute('data-src')) {
} } ;
var bg = $(this).data('bg');
$(this).css('background-image','url(' + bg + ')');
window.onload = setTimeout(init, 600);

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.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Create New...

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.