![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
|
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Nov 2007
Posts: 859
|
![]() 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. |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Jul 2009
Location: Netherlands
Posts: 364
|
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.
__________________
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Industry Role:
Join Date: Nov 2007
Posts: 859
|
I honestly do not know. That is why I am asking for help on the matter.
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: Nov 2009
Posts: 415
|
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() { $("#div_id").click( $("#div_id").html('<img src="/path/to/image.jpg" alt="" />'); ); }); |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#5 | |
Confirmed User
Industry Role:
Join Date: Nov 2007
Posts: 859
|
Quote:
Code:
<script type="text/javascript"> function showonlyone(thechosenone) { var galleryblock = document.getElementsByTagName("div"); for(var x=0; x<galleryblock.length; x++) { name = galleryblock[x].getAttribute("name"); if (name == 'galleryblock') { if (galleryblock[x].id == thechosenone) { galleryblock[x].style.display = 'block'; } else { galleryblock[x].style.display = 'none'; } } } } </script> Code:
<div name="galleryblock" id="galleryblock1" style="display: block;"> <table align="center" cellspacing="5" cellpadding="0"> <tr> <td><a href="/angel/j/jenny-poussin/">Jenny Poussin</a><br><a href="/galleries/picture/j/jenny-poussin/4/jenny-poussin-exquisite-and-cute-in-sexy-naked-christmas-red-lingerie-strip-tease/"><img src="/galleries/picture/j/jenny-poussin/4/jenny-poussin-exquisite-and-cute-in-sexy-naked-christmas-red-lingerie-strip-tease/preview.jpg" width="150" height="200" border="0"></a></td> <td><a href="/angel/b/bella-bellini/">Bella Bellini</a><br><a href="/galleries/picture/b/bella-bellini/3/bella-bellini-beautiful-and-cute-in-sexy-christmas-strip-tease-inside-public-store/"><img src="/galleries/picture/b/bella-bellini/3/bella-bellini-beautiful-and-cute-in-sexy-christmas-strip-tease-inside-public-store/preview.jpg" width="150" height="200" border="0"></a></td> <td><a href="/angel/a/aaliyah-love/">Aaliyah Love</a><br><a href="/galleries/picture/a/aaliyah-love/3/aaliyah-love-cute-in-christmas-lingerie-unwrapping-herself-in-sexy-white-stockings/"><img src="/galleries/picture/a/aaliyah-love/3/aaliyah-love-cute-in-christmas-lingerie-unwrapping-herself-in-sexy-white-stockings/preview.jpg" width="150" height="200" border="0"></a></td> <td><a href="/angel/a/alexis-texas/">Alexis Texas</a><br><a href="/galleries/picture/a/alexis-texas/3/alexis-texas-looking-cute-sucking-candy-cane-after-naked-christmas-outfit-strip-tease/"><img src="/galleries/picture/a/alexis-texas/3/alexis-texas-looking-cute-sucking-candy-cane-after-naked-christmas-outfit-strip-tease/preview.jpg" width="150" height="200" border="0"></a></td> <td><a href="/angel/a/alexis-texas/">Alexis Texas</a><br><a href="/galleries/picture/a/alexis-texas/2/alexis-texas-christmas-holiday-naked-red-nightie-and-red-panties-strip-tease/"><img src="/galleries/picture/a/alexis-texas/2/alexis-texas-christmas-holiday-naked-red-nightie-and-red-panties-strip-tease/preview.jpg" width="150" height="200" border="0"></a></td> <td><a href="/angel/l/lexi-belle/">Lexi Belle</a><br><a href="/galleries/picture/l/lexi-belle/3/lexi-belle-cute-christmas-lingerie-strip-tease-in-sexy-white-fishnet-stockings/"><img src="/galleries/picture/l/lexi-belle/3/lexi-belle-cute-christmas-lingerie-strip-tease-in-sexy-white-fishnet-stockings/preview.jpg" width="150" height="200" border="0"></a></td> <td><a href="/angel/l/lexi-belle/">Lexi Belle</a><br><a href="/galleries/picture/l/lexi-belle/2/lexi-belle-looking-cute-in-christmas-outfit-strip-tease-with-candy-cane-on-her/"><img src="/galleries/picture/l/lexi-belle/2/lexi-belle-looking-cute-in-christmas-outfit-strip-tease-with-candy-cane-on-her/preview.jpg" width="150" height="200" border="0"></a></td> </tr> </table> </div> |
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Join Date: Jul 2009
Location: Netherlands
Posts: 364
|
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.
__________________
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#7 | |
Confirmed User
Industry Role:
Join Date: Nov 2007
Posts: 859
|
Quote:
![]() |
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#8 | |
Confirmed User
Join Date: Jul 2009
Location: Netherlands
Posts: 364
|
Quote:
That would be something like: Code:
$(document).ready(function() { $("#clicker_id").click( $("#galleryblock1").html('<table........</table>'); ); }); 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.
__________________
|
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#9 | |
Confirmed User
Join Date: Jul 2009
Location: Netherlands
Posts: 364
|
Quote:
__________________
|
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Industry Role:
Join Date: Nov 2007
Posts: 859
|
Thanks! I'll give that one a try.
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#11 |
Confirmed User
Join Date: Jul 2009
Location: Netherlands
Posts: 364
|
If you cant get it to work I will try to create an example for you. Just let me know.
__________________
|
![]() |
![]() ![]() ![]() ![]() |