![]() |
Deferring loading of images on thumbnail blocks
I am using javascript to hide/show DIV blocks. Now, as you can also see, all the images from both DIV blocks are downloaded even if the second is hidden.
This is the page: http://www.exquisiteangelz.com/galleries/picture/ What I wish to do is defer the loading of the hidden block and make it load the images only when the visitor clicks to display the block in question. Does someone happen to know if it is possible to defer the loading of images so that they are loaded only when the visitor clicks to view the thumbnail block in question? And if yes, would you be kind enough to provide the code to implement it? I'd appreciate any help. |
Can you not only create the image place holders and set the ID attribs but dont specify the SRC yet? Then when u show the DIV also set the SRC for each image which then loads the images. I'm sure if u check out jQuery u can this.
|
Quote:
|
Hi,
Dont assign a image to the div yet, once someone clicks on the link (or div) add the image via jquery: Code:
$(document).ready(function() { |
Quote:
Code:
<script type="text/javascript"> Code:
<div name="galleryblock" id="galleryblock1" style="display: block;"> |
I think its best to load up your images URLs and IDs in an array and then use the jQuery method as displayed to loop through the array and set the images/html. More advanced would be to have the image URL be served and processed using AJAX.
|
Quote:
|
Quote:
That would be something like: Code:
$(document).ready(function() { I do not know how good you are but you should check out http://jquery.com/. Check out the examples as well, it might give you some ideas. |
Quote:
|
Thanks! I'll give that one a try.
|
Quote:
|
All times are GMT -7. The time now is 02:44 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc