Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   Deferring loading of images on thumbnail blocks (http://www.greenguysboard.com/board/showthread.php?t=55841)

A.J. Angel 2009-12-26 11:06 PM

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.

cd34 2009-12-26 11:21 PM

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
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.

A.J. Angel 2009-12-27 06:23 AM

Quote:

jquery (or mootools) will also allow you to control dom units so that you could have an onclick handler that would populate the
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:



cd34 2009-12-27 12:39 PM

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/

A.J. Angel 2009-12-27 05:33 PM

Quote:

Originally Posted by cd34 (Post 472717)
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.

MadCat 2009-12-28 04:27 AM

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.

MadCat 2009-12-28 04:29 AM

Optionally throw me a link to the page in PM and I'll hack it over to jQuery for you :)

Simon 2009-12-28 05:49 AM

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.

A.J. Angel 2009-12-28 12:38 PM

Quote:

Originally Posted by MadCat (Post 472736)
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 2009-12-28 12:39 PM

Quote:

Originally Posted by Simon (Post 472742)
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. |loony|


All times are GMT -4. The time now is 03:26 AM.

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