Any idea how a create dynamic perfect fitting img grids?

Hi there Paul,

[quote]…maybe it would have worked if you had supplied
the width and height attributes in the html…[/quote]

Actually, I did test that option and found it to be totally
unsatisfactory. :ng:

coothead

Fixing issues with image processing is about the only circumstances where waiting for the load event can make a difference.

Hi there Stephen,

[quote]“Fixing issues with image processing is about the only circumstances
where waiting for the load event can make a difference.”
[/quote]
it’s a shame that you did not tell me about this anomaly earlier. :smile:

As a “JavaScript” dabbler it took my trial-and-error method of
coding three days to discover this correct solution. :cold_sweat:

I always used to use “window.addEventListener(‘load’,foo,false)”,
and put the script in the head section of the document. :ok:

I only changed my ways when you told us mortal coders that it
was a very naughty habit and should be avoided. :ng:

Nevertheless, I will forgive you for your tardiness this once. :cool:

coothead

The situation you had was not even remotely the same as the one situation I found that needed the load event. The only thing they have in common is that they both include images. Even most scripts that do involve images don’t need to wait for the load event - just as only files that are not all going to have loaded by the time scripts attached before the </body> try to run, they are the only ones where waiting for load CAN ever be needed.

So now we have TWO examples of where the load event is actually needed out of the thousands of scripts using images that I know of and the many more millions of scripts that don’t use images (and can therefore never need to wait for load).

Now that there are two scripts that need the load event it is slightly more obvious that if we look at a few thousand more image scripts then there is a slight possibility that we may find a third such script. The one example I already had was testing for images that failed to load and so obviously needed to wait for load in order to see if they had.

Hi there Stephen,

you may not have realised that my post
was to be read as ‘tongue-in-cheek’. :mask:

I will flagellate myself for ten minutes to
recompense for my teasing. :grimacing:

coothead

I had sort of realised that but thought that it was worth while pointing out just how rare a situation is where the load event is needed like that.

Hi there Stephen,

whether it is rare or not, I have made a mental note to
always use “window.addEventListener(‘load’,foo,false)”
when manipulating images, just to be on the safe side. :cool:

coothead

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.