Results 1 to 4 of 4

Thread: Lightbox not working fast enough

  1. #1
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Lightbox not working fast enough

    1) Script Title:
    Lightbox image Viewer 1.0

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...tbox/index.htm

    3) Describe problem:

    I have placed the script on a page that loads 30 images on the page and I have them all going through the script. If I'm "quick on the trigger" and click the first lightboxed image, the script isn't kicking in and it just acts as a regular link and displays the image on a new page. Once the page is fully loaded, everything works as it should. It's just as the page is loading.

    Is there anyways to reduce the delay of the script initializing or am I stuck with it? Does version 2 solve my problems?

    Thanks.

    Purpleman

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Like my reply to your post about Ultimate Fade In slide show, look into image optimization to speed the loading of the page. Consider removing some of the images. 10 is a lot of images for any given page. Even with only 10 images, you would still have a problem like you describe though. Lightbox will not work until it initializes. Usually this is done onload of the page. I have not tested this but, you might be able to get it to initialize for each thumbnail like so:

    HTML Code:
    <a href="large.jpg" rel="lightbox"><img src="small.jpg" onload="initLightbox();"></a>
    Another way of doing this that might work better and that can be used with text triggers as well as for thumbnail image triggers is:

    HTML Code:
    <a href="large.jpg" rel="lightbox"><img src="small.jpg"></a>
    <script type="text/javascript">initLightbox();</script>
    Whichever method you use, it would need to be done for each trigger.



    To speed loading of the page in general - avoid nested tables and, make sure that all of the images used as thumbnail triggers (if any) are true thumbnails and are optimized.

    Don't use the larger images themselves, as some folks do, relying upon the browser to visually scale them down to the dimensions of thumbnails. When they do that, it can take a long time to load each trigger.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Mar 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Me too, I got the same prob as that of purpleman bt I hv only 6 thumb pics displayed on the page.

    There might be a prob with the connection speed as well. (For e.g: having people using dial-up speed)

    I will try to do as jscheuer1 suggested that is placing the method initlightbox for each pic.

    Should I remove the following from lightbox.js file:

    Code:
    Event.observe(window,'load',function(){ Lightbox.initialize(); });

  4. #4
    Join Date
    Mar 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well I comment the following:

    Code:
    Event.observe(window,'load',function(){ Lightbox.initialize(); });
    and added the method init() for each pic.

    It seems to work coz I cannot really test since I'm on an ADSL connection.

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
  •