Discussion Locked

Image Loading

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How do I pre-load images(especially background images) that really takes time to load completely??

7 replies

by jay eckles

I assume you're talking about how you preload images in a web page using Javascript. There are two methods. The first does not require javascript, the second does.

The first is a little inelegant, but it works. Just put the image somewhere (presumably at the bottom) on a page with the following tag:

That will load the image, and will only make a 1x1 dot visible - this looks like a period, and in fact you could put it in a place where it would look like a period:
Here's a sentence
If you want to make sure the image is completely invisible (you don't even want to see a 1x1 dot on the page), you can put your image tag within a div element, andset the visibility and display properties of the div's style to make it invisible - this only works on newer browsers that support the style properties used:

The second method that uses javascript is pretty simple:

This will begin downloading the image as soon as the page is loaded; if you use image.gif later in the page (say as a mouseover) or on a page the client subsequently visits, it will already be loaded.

by rsv

HI,

Hope this is pretty clear to you.
Hope this helps you.
Good Luck...:)

by rsv

Oops!!! small correction..
one bracket is missing in the onload function.Just make it correct like this
onLoad="MM_preloadImages ('images/Celebrations.jpg')

IF you want to preload other images, you can just give them. like this...

onLoad="MM_preloadImages ('images/Celebrations.jpg','images/pic.jpg',
'images/pic1.jpg', images/photo.gif')
like this.....

by aleranderann

[url=http://www.rasteredge.com/how-to/csharp-imaging/load-from-net-graphics/]Image loading from graphics[/url], this is the latest solutionn I worked out on image loading, and see more sample code:
public static void LoadImageFromScreenDemo()
{
REImage reImage = new REImage();

reImage.LoadImageFromGraphicScreen(true);// Get image from screen (flag to indicate if working area or not)

This discussion is closed to new replies.