Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Can I PreLoad images in slideshow?

  1. #1
    Join Date
    Sep 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Can I PreLoad images in slideshow?

    HI,
    Im not all that experienced with website creation, but I managed to put together a manual slideshow for a photographer's site. Only issue is that
    photos seems to take a few seconds to load each time the arrow is clicked.
    Is there something I can add to my script to preload the images to they load faster?
    The second time thru the slideshow goes way faster, so I thought this might help if there is a way to do it. Ive read some about preloading, but dont know where or how.....thanks!
    Here is the page Im working on. also, any other helpful advice is welcome.
    http://www.staceydoylephotography.com/AnneMorgan.html

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

  3. #3
    Join Date
    Sep 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks, that looks pretty cool. So I do one of these for each gallery page?

  4. #4
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    yes, however instead of putting the javascript on every page, you can put the script itself in its own file...
    something like

    scripts.js

    then just include it in the head of your gallery page
    Code:
    DOCTYPE...
    <script type="text/javascript" src="scripts.js"></script>
    </head>
    <body>
    ...
    just be sure that the file name lines up

  5. #5
    Join Date
    Sep 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok, this is going to show my inexperience and lack of knowledge on this but.......not sure what you mean by this one.
    "just be sure that the file name lines up"

  6. #6
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    from that page, extract all of the javascript... open up a text-editor (eg... notepad) paste the javascript code... save it as some file name

    open up the gallery page in a text-editor, in the <head> tag put
    Code:
    <script type="text/javascript" src="file name.js"></script>
    that is what I mean. the name of the external script file, and the name of the call inside the page, need to be the same

  7. #7
    Join Date
    Sep 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok, I understand that. If I may, another question though.

    So if I save the preload script on a separate text edit file as you suggest....
    ....The preload script you linked to calls for me to add the URL of the page it goes to and all the images for that page.

    So....do I need to save a separate text editor file for each gallery page I create?
    Does this question make sense?

  8. #8
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    nope you just need to tweek the code
    Code:
    var yourImages = new Array("http://yourdomain.com/test1.gif","http://yourdomain.com/test2.gif")
    take that line out of the script and place it in the gallery page.

    Code:
    <script type="text/javascript" src="filename.js">
    var yourImages = new Array('image1.jpg', 'image2.gif', etcetc);
    </script>

  9. #9
    Join Date
    Sep 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok, I see.
    What about this line in the script though...

    var locationAfterPreload = "http://dynamicdrive.com" // URL of the page after preload finishes

    I will have several gallery pages so how will that work if I have one file with this script?

    Again, thanks so much for this help!

  10. #10
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    oops yah. put that underneath the yourImages.... sorry

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
  •