@Angry_Black_ManApr 05.2012 — #interesting read. he didn't actually use AJAX to preload any type of image though, so why did he include that as a method?
@Logic_AliApr 06.2012 — #Obviously images can be pre-loaded without JS using <img> with 0-width/height or css backgrounds, but in cases where the display of the pre-loaded images is script-dependent, then the preloading may as well be done by a script routine, ensuring that it's not done if script isn't supported.
I'm sure you've seen countless examples using the Image() object. Don't make the classic error of applying multiple filenames to the same instance of an Image object, using a loop.
@JMRKERauthorApr 06.2012 — #Well, I tried the first JS only example in the link 'Wolfshade' provided,
but now I have more questions that before... <i> </i><div class="hidden"> <script type="text/javascript"> <!--//--><![CDATA[//><!-- var images = new Array() function preload() { for (i = 0; i < preload.arguments.length; i++) { images[i] = new Image() images[i].src = preload.arguments[i] } } preload( "http://domain.tld/gallery/image-001.jpg", "http://domain.tld/gallery/image-002.jpg", "http://domain.tld/gallery/image-003.jpg" ) //--><!]]> </script> </div>
I changed the preload() array elements to valid images
The problem seems to be that there are TWO objects named preload()!!!
The first object is a function that should create the image elements.
The second object is 'preload( files )' and appears to be an array of files to be displayed (changed to valid links).
How can this be??? ?
I also added 3 <img...> elements in the <body> because nothing seemed to display, but that did nothing either.
How would I reference the <img...> tags? Would I need to hard-code the <img> tags?
Or could they be generated dynamically to match the number of elements of the 'images' array?
Bottom line is that I think I don't understand what I'm doing at this point in time!
@Logic_AliApr 06.2012 — #I changed the preload() array elements to valid images
The problem seems to be that there are TWO objects named preload()!!![/quote] The first is a function, the second is a call to that function. I also added 3 <img...> elements in the <body> because nothing seemed to display, but that did nothing either.
How would I reference the <img...> tags? Would I need to hard-code the <img> tags? [/quote]This code isn't about displaying images, it's about having them downloaded and in memory, ready to be displayed when their filename is specified by a script.
@JMRKERauthorApr 06.2012 — #The first is a function, the second is a call to that function.
This code isn't about displaying images, it's about having them downloaded and in memory, ready to be displayed when their filename is specified by a script.
I thought you knew all this of old.[/QUOTE]
That was the concept problem I was talking about in the 1st post.