Jump to content

Post-Preloading images


Michdd

Recommended Posts

Couldn't think of a better title x.x For some Chat website that I made in AJAX/Php There's a section that contains images of smilies. This is about 250KB of images, so it's not really friendly to load it when the page starts. Currently there's a function I made in php which gets the contents for the smiley DIV, (contains image links with an onclick attribute). Now I guess the best way to do this would be through Ajax? But I'm not really sure.. I want to create a button that when pressed will preload all the images, (Temporary showing a [Loading] bar) Then once they're all loaded it will switch the contents of that DIV. I can think of a few ideas, but I'm thinking there's a better way.. My one idea would be through 2 Ajax queries.. First one sending back an array to JavaScript containing the names of all the smilies, so it can loop through the array, and preload the images, then the second Ajax query running once that's finished, to get the contents of the DIV itself.

Link to comment
https://forums.phpfreaks.com/topic/163502-post-preloading-images/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.