Results 1 to 4 of 4

Thread: Preloading images

  1. #1
    Join Date
    Apr 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Preloading images

    When I am moving my mouse over links in the menu at http://nintendosan.atspace.com it takes some time for the pictures to load. This is the script I use between the head tag, but it doesn┤t work. Why?

    <SCRIPT language="JavaScript">
    <!--
    pic1= new Image(245,153);
    pic1.src="test.jpg";

    pic2= new Image(245,153);
    pic2.src="test2.jpg";

    pic3= new Image(245,153);
    pic3.src="test3.jpg";

    pic4= new Image(245,153);
    pic4.src="test4.jpg";
    //-->
    </SCRIPT>

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Preloading images doesn't magically make them download instantly - it merely loads them before everything else, used properly. However, your code will not wait until the images are loaded before loading the rest of the page. The images are loading at the same time as the page.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Apr 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Is it possible to make the pictures appear instantly in explorer? In mozilla they do, but not in explorer

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Of course it isn't. They have to be downloaded at some point, which means they're limited by the speed of the connection.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •