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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.