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.

 

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help.

 
Thread Tools
Old 12-26-2009, 03:29 AM   #1
A.J. Angel
Confirmed User
 
Industry Role:
Join Date: Nov 2007
Posts: 859
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.
A.J. Angel is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-26-2009, 02:21 PM   #2
CodeR70
Confirmed User
 
CodeR70's Avatar
 
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.
CodeR70 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-26-2009, 09:05 PM   #3
A.J. Angel
Confirmed User
 
Industry Role:
Join Date: Nov 2007
Posts: 859
Quote:
Originally Posted by CodeR70 View Post
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.
I honestly do not know. That is why I am asking for help on the matter.
A.J. Angel is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-27-2009, 01:34 AM   #4
symtab
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="" />');
);
});
Good luck!
symtab is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-27-2009, 03:58 AM   #5
A.J. Angel
Confirmed User
 
Industry Role:
Join Date: Nov 2007
Posts: 859
Quote:
Originally Posted by symtab View Post
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="" />');
);
});
Good luck!
Hi symtab, it's not one image only. It's a table of thumbnails. Here's the javascript code that I use to switch between the DIV blocks:

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>
And this is the table of thumbnails wrapped between DIV tags with the ID to swich between them:

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>
A.J. Angel is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-27-2009, 12:11 PM   #6
CodeR70
Confirmed User
 
CodeR70's Avatar
 
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.
CodeR70 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-27-2009, 03:28 PM   #7
A.J. Angel
Confirmed User
 
Industry Role:
Join Date: Nov 2007
Posts: 859
Quote:
Originally Posted by CodeR70 View Post
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.
LOL! That's too advance for me in words! Would it be possible for you to provide an example code for me to work from? I'm not a savvy coder.
A.J. Angel is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-27-2009, 03:51 PM   #8
CodeR70
Confirmed User
 
CodeR70's Avatar
 
Join Date: Jul 2009
Location: Netherlands
Posts: 364
Quote:
Originally Posted by A.J. Angel View Post
LOL! That's too advance for me in words! Would it be possible for you to provide an example code for me to work from? I'm not a savvy coder.
I'm in fact thinking now that it would be easier to "load" the whole image block html content (everything between the div). Take a look at the jQuery example of symtab. The html he's including there is just a single tag, but you can include the complete DIV content you have as well.

That would be something like:

Code:
$(document).ready(function() {
$("#clicker_id").click(
$("#galleryblock1").html('<table........</table>');
);
});
But it's a lot of HTML code that needs to be included and I'm not into jQuery yet to know if there is a better way to include such a huge block of html code.

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.
CodeR70 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-27-2009, 04:19 PM   #9
CodeR70
Confirmed User
 
CodeR70's Avatar
 
Join Date: Jul 2009
Location: Netherlands
Posts: 364
Quote:
Originally Posted by CodeR70 View Post
But it's a lot of HTML code that needs to be included and I'm not into jQuery yet to know if there is a better way to include such a huge block of html code.
Here at the examples you see how you can load the content from a different file.
CodeR70 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-27-2009, 10:07 PM   #10
A.J. Angel
Confirmed User
 
Industry Role:
Join Date: Nov 2007
Posts: 859
Thanks! I'll give that one a try.
A.J. Angel is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 12-28-2009, 12:43 AM   #11
CodeR70
Confirmed User
 
CodeR70's Avatar
 
Join Date: Jul 2009
Location: Netherlands
Posts: 364
Quote:
Originally Posted by A.J. Angel View Post
Thanks! I'll give that one a try.
If you cant get it to work I will try to create an example for you. Just let me know.
CodeR70 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
 
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.