SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist escapedf's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool --- Preloading script ??? --

    Hi all,
    Ive created a site here:
    http://www.plan-myafrica.com/see.htm

    If you click on ths thumbnails, a bigger picture pops up..
    problem is, the bigger pictures sometimes take ages to load up..
    Can anyone suggest a preloading script i can put in here for the bigger pictures, so the pictures load while the page loads?? or anything similar?

    Thanks!
    Dee
    "have the courage to follow your heart and intuition. They somehow already know what you truly want to become"

  2. #2
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by escapedf View Post
    Can anyone suggest a preloading script i can put in here for the bigger pictures, so the pictures load while the page loads?? or anything similar?
    That script has a bizarre way of doing things...
    Blanket pre-loading will increase your bandwidth usage and on slow connections may not always appear to improve performance. You don't actually need a script to pre-load images - you can have normal <img> tags in a hidden div or set their width and height to 0.

    Code:
    function PreLoader()
    {
     this.holder=[];
     
     for(var i=0, len=arguments.length; i<len; i++)
     {
      this.holder[i]=new Image();
      this.holder[i].src=arguments[i];
     }
    }
    
    
    Usage:
    
     new PreLoader('your.jpg', 'images.jpg', 'here.jpg');
    Tab-indentation is a crime against humanity.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Location
    Bristol, England
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Instead of a preloading script which will (if the many images are as you say "big") drain bandwidth for people on slower connections, I would suggest something like lightbox which will show a loading bar.


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
  •