Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Member TheGardener's Avatar
    Join Date
    Jun 2006
    Posts
    62
    Member #
    13332
    Simple question. I think I've figured out a way to eliminate the use of an iframe on my image gallery page (http://www.imagegardenphoto.com/home.php?id=gallery). The thumbnail lists for each gallery section, which are currently placed in an iframe, could be loaded into a set of scrolling divs. The thumbnail list for the active directory section would be loaded into a visible div, while the thumbnail lists for the inactive sections would be loaded into invisible divs. When the button for a gallery section is clicked, a Javascript function will change the visibility of the thumbnail divs accordingly.

    However, I want to know whether browsers will actually load the data for those invisible images. I don't want to waste viewers' time and my bandwidth by having them download every single thumbnail in the gallery when they visit the gallery page. If I place thumbnail images in invisible divs, will they be loaded immediately or will they be loaded only when they become visible? Thanks.

  2.  

  3. #2
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    I'm relatively certain they'll be loaded immediately. The visibility of an image should have nothing to do with whether it's loaded or not. As long as you list the divs in order, though, the images *should* download in order. The disadvantage being, of course, if they come to the site then click on the third gallery, they might have to wait for the first two galleries' images to load before being able to get the third one's.

    I want to say this sounds like a job for a little bit more Javascript, where switching between thumbnail lists is done via Javascript that dynamically generates the image tags. The only issue with that is that you have to have a list of the files you'll be using somewhere. However, you could do some magic with XMLHttpRequest there and make things really cool.

  4. #3
    Member TheGardener's Avatar
    Join Date
    Jun 2006
    Posts
    62
    Member #
    13332
    Thanks for letting me know. I'm already using PHP to grab filenames for the images, thumbnails and captions from their directories, so I'll try using the same type of PHP code to encapsulate the names for those files into Javascript objects, then use those objects to create the image browser div.

  5. #4
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Yep, that sounds like a good idea. Tossing the images for the current gallery into a nice array would be cool. Now, if you want to be really slick, you can use a JS library like script.aculo.us and make the div of images fade in while the old ones fade out or something.

  6. #5
    Senior Member minute44's Avatar
    Join Date
    Mar 2006
    Location
    Nottingham, UK
    Posts
    264
    Member #
    12849
    Yes if you have a page with lots of divs with images inside them but they're not all visible the browser will still load the images.

    They appear in the code... the browser will load them. the only thing the visible/invisible attribute does is tells the browser wether to show you the loaded image or not.

    This is a draw-back to an otherwise decent effect. You can have one page with many divs so when you click a link it doesn't load another page, just hides the current div and shows another but the file size of your one html file is a lot bigger as it has more code and has to load more images.

    Ths however is not the worst problem about using this effect. By using show/hide behaviours you are "breaking the back button" this is a serious no-no.
    No ma'am, we in IT don't have a sense of humor we're aware of.

  7. #6
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    But there are several ways of unbreaking the back button, and these come in even more useful when you use AJAX to fetch information instead of loading it all at once.

    Breaking the back button is bad, but then, if I remember correctly, IE's back button is already broken in that switching pages inside an iframe, then hitting back, will spin you out of the page entirely instead of just going back inside the iframe. It might be another browser that does this, though, and I've only got IE7 to experiment with right now.

    Anyway, certain libraries like Dojo provide ways to unbreak the back button, though they do still require some work.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:49 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com