SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2006
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    When are images downloaded?

    I'm thinking of using javascript to display a larger popup picture when the mouse hovers over a thumbnail version. Problem is there will be quite a few thumbnails on the page and downloading all the larger images will take a long time.

    If the img src is in a javascript function will this only retrieve the image when the mouseover triggers the function call?

  2. #2
    SitePoint Zealot
    Join Date
    Dec 2006
    Posts
    182
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's loaded whenever you set the img.src, either an element or an image object. So if you have a function that sets the source, then it will only load when the function is called.

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2006
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So it will only request the image from the server when the function is called?

    Is that in all cases and is there a way to test this as Firefox seems to indicate the total page size includes those images which might not be called.


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
  •