Results 1 to 2 of 2

Thread: using js to preload then show pictures

  1. #1
    Join Date
    May 2008
    Posts
    8

    using js to preload then show pictures

    I just spent 3 hours analyzing tons of lightboxes, image galleries, jQuery plugins. Now I'm a bit frustrated.
    I don't want a snazzy animation effect.
    I don't want a pre-made layout.


    This is what I want:

    On page load, 12-15 bigger images are preloaded into browser cache.
    Div#container contains a default image.
    When user clicks a thumbnail link, the corresponding (bigger) preloaded image shows inside #container.


    A jQuery solution would be good. Any assistance is mmmmmuch appreciated.

  2. #2
    Join Date
    Jul 2006
    Posts
    9
    i'd use this:

    Code:
    <div id="container>
         <img src="/path/to/image1.jpg">
    </div>
    <div class="thumbs">
    <a href="/" rel="/path/to/image1.jpg">image 1</a>
    <a href="/" rel="/path/to/image2.jpg">image 2</a>
    <a href="/" rel="/path/to/image3.jpg">image 3</a>
    </div>
    jquery:

    Code:
    $('.thumbs a').click(funtion(evt)
    {
         evt.preventDefault();
         $('#container img').attr('src', $(this).attr('rel'));
    });
    why do you want the images to preload? its a waste of bandwidth if the user never clicks on a thumbnail

Similar Threads

  1. Help with cut and paste javascript slide show on my site?
    By Ella in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 29 Aug 2006, 10:06 PM

Posting Permissions

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