2

I am using lazyload to display my images in my website (with data-src instead of src).

However, when you reload the page, you can see the alt tag appear (during 0.1s during the loading). I saw some similar questions, but not exactly helpful because nothing works for me, for example like this class:

 img:-moz-loading {
  visibility: hidden;
}

There is a way to hide the alt tag and the little picture enter image description here (without removing the tag) during the reload of the page ?

The alt tag should only appear if the image doesn't exist at the end of the load

Thank you,

Fabien
  • 389
  • 2
  • 5
  • 15
  • 1
    You could try using the NgIf directive https://angular.io/api/common/NgIf and then create a loading variable to assign boolean to based on when your content is done loading. Just a thought – Brian Stanley Nov 01 '18 at 19:25
  • A common technique is to hide it as the default style and then display it once it's loaded. – The Muffin Man Nov 01 '18 at 19:30
  • How do you know when it's loaded ? Thanks for you answers, i will try ngif – Fabien Nov 01 '18 at 19:37
  • It works perfectly with ng-if. Thank you. But for my part, it seems to be a bad practice to use that – Fabien Nov 01 '18 at 19:47
  • Same here: https://stackoverflow.com/questions/68166235/firefox-alt-text-appears-while-loading-image – Fred K Jun 29 '21 at 06:36

0 Answers0