SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2007
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Preloading Images

    Hey,

    I am just playing around with the "onMouseOver" event handler using it to swap images and such but I just wondered what the syntax is to preload the images to get rid of the delay on hover?

    I know I put it in the head but I am having a blank moment and I don't know how I create it in the head and then how do I referene to it for the source?

    I hope that is clear enough to understand.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    4 Thread(s)
    Code JavaScript:
    var image = [];
    image['myimage'] = new Image();
    image['myimage'].src = 'path/image.gif';

  3. #3
    SitePoint Enthusiast
    Join Date
    Dec 2007
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ok

    Thanks for the code.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •