Greenguy's Board WebcamWiz CRAZY $5,000 Reward Bonuses

WebcamWiz CRAZY $5,000 Reward Bonuses WebcamWiz CRAZY $5,000 Reward Bonuses WebcamWiz CRAZY $5,000 Reward Bonuses WebcamWiz CRAZY $5,000 Reward Bonuses WebcamWiz CRAZY $5,000 Reward Bonuses

Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2009-12-26, 11:06 PM   #1
A.J. Angel
And Lord, we are especially thankful for nuclear power, the cleanest, safest
energy source there is. Except for solar, which is just a pipe dream
 
Join Date: Sep 2008
Posts: 229
Question 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   Reply With Quote
Old 2009-12-26, 11:21 PM   #2
cd34
a.k.a. Sparky
 
cd34's Avatar
 
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
jquery (or mootools) will likely have a library that does lazy loading or asynchronous loading of images. lazy loading loads the images as they are pulled into the viewport - asynchronous allows the page to load and then loads the images sequentially on the page.

jquery (or mootools) will also allow you to control dom units so that you could have an onclick handler that would populate the <div> with the appropriate html which would then load the images/html.

ajaxrain.com would probably be one source for an addon that would do it.
__________________
SnapReplay.com a different way to share photos - iPhone & Android
cd34 is offline   Reply With Quote
Old 2009-12-27, 06:23 AM   #3
A.J. Angel
And Lord, we are especially thankful for nuclear power, the cleanest, safest
energy source there is. Except for solar, which is just a pipe dream
 
Join Date: Sep 2008
Posts: 229
Quote:
jquery (or mootools) will also allow you to control dom units so that you could have an onclick handler that would populate the <div> with the appropriate html which would then load the images/html.
This feature sounds like what I am looking for. How is it called? I have the following javascript code to be able to switch between DIV blocks and the HTML code below is an example of the DIV blocks with thumbnails.

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>
A.J. Angel is offline   Reply With Quote
Old 2009-12-27, 12:39 PM   #4
cd34
a.k.a. Sparky
 
cd34's Avatar
 
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
Their online documentation is superb for being an open source product:

http://docs.jquery.com/Main_Page

However, I wouldn't be surprised if you couldn't find an addon that someone has already written at http://www.ajaxrain.com/ or http://plugins.jquery.com/
__________________
SnapReplay.com a different way to share photos - iPhone & Android
cd34 is offline   Reply With Quote
Old 2009-12-27, 05:33 PM   #5
A.J. Angel
And Lord, we are especially thankful for nuclear power, the cleanest, safest
energy source there is. Except for solar, which is just a pipe dream
 
Join Date: Sep 2008
Posts: 229
Quote:
Originally Posted by cd34 View Post
Their online documentation is superb for being an open source product:

http://docs.jquery.com/Main_Page

However, I wouldn't be surprised if you couldn't find an addon that someone has already written at http://www.ajaxrain.com/ or http://plugins.jquery.com/
I found the lazy loading plug-in that would load images only when they are nearly scrolled to or displayed on the screen. But since the DIV switch is at the bottom of the block, it is no use for me since when changing DIV blocks, visitors are not returned to the top of the page.
A.J. Angel is offline   Reply With Quote
Old 2009-12-28, 04:27 AM   #6
MadCat
If something's hard to do, then it's not worth doing
 
MadCat's Avatar
 
Join Date: Sep 2008
Location: Berlin, Germany
Posts: 247
If you have the div show up on a click, you want to do this, if you are using jQuery:

$('#id-for-the-link').click(function() {
// do div showing here
return false;
});

The 'false' will not process the link that goes to '#' which is what yoinks you back to the top of the page.
__________________
What's blue and not heavy?
MadCat is offline   Reply With Quote
Old 2009-12-28, 04:29 AM   #7
MadCat
If something's hard to do, then it's not worth doing
 
MadCat's Avatar
 
Join Date: Sep 2008
Location: Berlin, Germany
Posts: 247
Optionally throw me a link to the page in PM and I'll hack it over to jQuery for you
__________________
What's blue and not heavy?
MadCat is offline   Reply With Quote
Old 2009-12-28, 05:49 AM   #8
Simon
That which does not kill us, will try, try again.
 
Simon's Avatar
 
Join Date: Aug 2003
Location: Conch Republic
Posts: 5,150
Send a message via ICQ to Simon Send a message via AIM to Simon Send a message via Yahoo to Simon
Quote:
the DIV switch is at the bottom of the block, it is no use for me since when changing DIV blocks, visitors are not returned to the top of the page
A.J., you may want to rethink the idea of not returning the surfer to the top of the page. Some surfers won't even notice the changes and will leave thinking that's all there is. Return them to the top, and add a second switch control link at the top too, and you'll have more surfers sticking around I think.
__________________
"If you're happy and you know it, think again." -- Guru Pitka
Simon is offline   Reply With Quote
Old 2009-12-28, 12:38 PM   #9
A.J. Angel
And Lord, we are especially thankful for nuclear power, the cleanest, safest
energy source there is. Except for solar, which is just a pipe dream
 
Join Date: Sep 2008
Posts: 229
Quote:
Originally Posted by MadCat View Post
Optionally throw me a link to the page in PM and I'll hack it over to jQuery for you
I do not use jQuery. I only use javascript for the DIV block switch.

Here is the link: http://www.exquisiteangelz.com/galleries/picture/
A.J. Angel is offline   Reply With Quote
Old 2009-12-28, 12:39 PM   #10
A.J. Angel
And Lord, we are especially thankful for nuclear power, the cleanest, safest
energy source there is. Except for solar, which is just a pipe dream
 
Join Date: Sep 2008
Posts: 229
Quote:
Originally Posted by Simon View Post
A.J., you may want to rethink the idea of not returning the surfer to the top of the page. Some surfers won't even notice the changes and will leave thinking that's all there is. Return them to the top, and add a second switch control link at the top too, and you'll have more surfers sticking around I think.
I wish so but I am not a savvy coder especially anything else that HTML and CSS. So telling me to do this or that in javascript, PHP, it's like Chinese for me.
A.J. Angel is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:12 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc