[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 319
  • Last Modified:

Image change onmouse over

I'm using attached code to change the image when mouse point over the image.

The problem is, when mouse is over the image, it downloads the image from server, and then change. I mean it takes a bit of time to change.

Is it possible both image will load when page the page gets loaded. and it will change image immediately when mouse over the image.
<img src="img-0.GIF" onmouseover="this.src='img-1.GIF';" onmouseout="this.src='img-0.GIF';">

Open in new window

1 Solution
Roger BaklundCommented:
Yes, you can preload the image with javascript, for instance:

img = new Image();
img.src = "img-1.GIF";
marchentAuthor Commented:
sounds nice to me.

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now