According to the default behavior, the attribute is altdisplayed for the first time just before the image is rendered. I am showing 25 images in a grid, so it looks a bit uncomfortable since all attributes are displayed first alt.
alt
Can I hide attributes altin Firefox?
Note: alt attributes contain dynamic names in my case.
A way to prevent the display of attribute values altis to remove the attribute.
alt (not tag) , , , , . , , , , .
alt ( CSS-) Firefox, , ,
img { background: white; color: white; }
CSS. , alt , .
, , , , :
.yourClass img { color: transparent; }
,
img:-moz-loading { visibility: hidden; }
, , , alt , , , , , .
title? ; , Firefox - . , img { color: white; } ?
img { color: white; }
, :
<img src = "283414_2114217089554_728204_nn.jpg" onload="this.setAttribute('alt','this is the alt of my image');" />
, ...:))
, alt, , image-to-show, div, . , , div gif, - :
image-to-show
// show loading image $('.loader').show();
div .
// main image loaded ? $('.image-to-show').load(function(){ // hide/remove the loading image $('.loader').hide(); });
, ID . , - data-loading true $('.image-to-show').data('loading', false)
data-loading
$('.image-to-show').data('loading', false)
, , .
:
I also like to disable the default image behavior of Firefox:
Just found a better solution:
img:-moz-loading { font-size: 0; }
This will hide alternate text while Firefox loads the contents of the image.
I would start by adding this CSS, which will hide all the images using alt text (not display: nonebecause we want to undo this and we won't know what to undo):
display: none
img[alt] { width: 0; height: 0; }
And then showing it as soon as it is loaded (this uses jQuery):
$(document).ready(function() { $('img[alt]').on('load', function() { this.style.width = 'auto'; this.style.height = 'auto'; }); });