The problem is this, I tried to invent a bicycle, well, so to speak, to repeat Java Script, invented it, it worked, then it stopped, I can’t understand what the problem is (I didn’t bother with cross-browserism, so don’t blame it, to make it work). Here is the code.
That's what I wanted to invent (jQuery); this code works ...
$('img').each(function() { if($(this).width()>500) $(this).fadeOut(4000); })
And here is the Java Script
var obj = document.getElementsByTagName('img'), k = 0, arr = new Array(), i, n; for (i = 0; i < obj.length; i++) if (obj[i].width > 500) { arr[k] = obj[i]; k++; } n = k; k = 1; function opacity_() { if (k <= 0) { clearInterval(id); for (i = 0; i < n; i++) arr[i].style.display = 'none'; } else { for (i = 0; i < n; i++) arr[i].style.opacity = k; k -= 0.004; } } opacity_(); var id = setInterval(function () { opacity_(); }, 10);
says that obj.length = 0
, the question is easy in principle, but I’m dumbing for something; )) There are images in the document that have a width=960px
.