1

In one version of chrome I get this wI get this when I inspect an image

<img src="http://esg.com/wp-content/uploads/2016/03/ESG-hudsonlg-01-600x548.jpg?x80200" data-lazy-type="image" data-src="http://esg.com/wp-content/uploads/2016/03/ESG-hudsonlg-01-600x548.jpg?x80200" class="lazy-loaded">

In the newer version, where the image does not load, I get this code

<img src="" data-lazy-type="image" data-src="http://esg.com/wp-content/uploads/2016/03/ESG-hudsonlg-01-600x548.jpg?x80200" class="lazy-hidden">

any ideas for resolving / correcting that missing image link? Thanks!!

Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
Emeka Patrick
  • 147
  • 2
  • 11
  • what you did the code please show the code so we can let you know what is the issue. – Akshay Shah Sep 07 '17 at 05:29
  • Possible duplicate of [Loading an image using data-src and not just src](https://stackoverflow.com/questions/41533464/loading-an-image-using-data-src-and-not-just-src) – Burhan Khalid Sep 07 '17 at 05:30

1 Answers1

1

jQuery(document).ready(function($){
    $('.lazy-hidden').each(function(){
      var src = $(this).attr('data-src');
      $(this).attr('src',src);
        
    })
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<img src="" data-lazy-type="image" data-src="http://elizabethstreetgallery.com/wp-content/uploads/2016/03/ESG-hudson-mirrors-sm-lg-01-600x548.jpg?x80200" class="lazy-hidden">
<br />
<img src="" data-lazy-type="image" data-src="http://elizabethstreetgallery.com/wp-content/uploads/2016/03/ESG-hudson-mirrors-sm-lg-01-600x548.jpg?x80200" class="lazy-hidden">


<!-- I had used demo image src as your src is not opening in browser too. -->

It would be better if you had posted your code, yet you can use this hack to achieve your requirement.

EDIT Let me tell what I have done here, I took current data-src of each image, assigned it a variable, then replace current image src to the data-src.

Thanks

Bilal Hussain
  • 994
  • 1
  • 10
  • 25
  • Hi Bilal, many thanks for writing. Here is the exact code... working... not working... – Emeka Patrick Sep 07 '17 at 06:18
  • I had used two images, so that you wont have any problem in running this js dynamically or for more than one images. – Bilal Hussain Sep 07 '17 at 06:22
  • hi bilal, many thanks for your answer. if this is happening across the site will I need to make changes for every instance or does the code above cover things globally? – Emeka Patrick Sep 07 '17 at 06:25
  • No, you dont need to do changes for every instance. Just paste this js in footer and make sure all the images have '.lazy-hidden' class added. Thanks – Bilal Hussain Sep 07 '17 at 06:26
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/153838/discussion-between-bilal-hussain-and-emeka-patrick). – Bilal Hussain Sep 07 '17 at 06:49