Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Old 07-09-2005, 09:19 PM Image Load Time
Junior Talker

Posts: 2
Trades: 0
My Problem:
The layout I use on my personal site is created by making certain divisions visible/invisible with Javascript and CSS. As a result, the entire source code for my site is actually on one page. This isn't really an issue, except that the images on my Pictures division all load as soon as someone opens my site, which slows load time.

My Question:
Isn't there a way to stop these images from loading until someone uses an onClick() object?

(My site: http://home.ripway.com/2004-10/183524/index.html)

Thank you so much.
RoseBlood74 is offline
Reply With Quote
View Public Profile Visit RoseBlood74's homepage!
 
 
Register now for full access!
Old 07-09-2005, 09:23 PM
Junior Talker

Posts: 2
Trades: 0
I've suddenly realized that posting my URL may be forbidden, and I am terribly sorry if it is. (I cannot remember...)
RoseBlood74 is offline
Reply With Quote
View Public Profile Visit RoseBlood74's homepage!
 
Old 07-10-2005, 04:30 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Nope if they are on the page they get loaded. You can use the onclick to load the image but the user would then have to wait until the image loaded.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-10-2005, 06:32 AM
onlyplace4's Avatar
Extreme Talker

Posts: 159
Location: Skegness, Lincolnshire, England
Trades: 0
The only trick I can think of off the top of my head would be to have all the images on the various layers initially set to a small transparent gif. Then when the visitor to your site uses the OnClick() you can simply swap the relevant image sources for the correct ones in much the same way you would with a mouse rollover.

Of course you'll need to make sure that each layer has it's own relevant chunk of JS to handle all this. Lets say you have a layer called 'layer1', and I will assume that you have a JS function to make the layer visible, so Iwon't go into that. Your OnClick() will look something like:

.... onClick="make_visible(1)"; ...

You will then need to add image swapping code to the end of the function I have called 'make-visible' for the sake of example. Notice that I have called the function simply with a number, this is to make the image swapping easier. I am sure you can handle this for the visibility part of your function. In addition to the extra code at the end of your function you will need an array containing a list of numbers of how many images are contained in each layer, and then will need to name the images accordingly - the code below should help you.
Code:
imgs_in_layer = array (5,3,6,4); // 4 layers numbered 0, 1, 2 and 3
function make_visible(which_layer) {
// your original code here to make the layer visible
    howmany_images = imgs_in_layer[which_layer];
    for (n=0; n<howmany_images; n++) {
        img = "images/layer"+which_layer+"_"+n+".jpg";
        document.images['layer'+which_layer+n].src = img;
    }
}
I hope that's clear enough. It should work, but I had a heavy night last night and my mind might still be a bit scrambled!
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
onlyplace4 is offline
Reply With Quote
View Public Profile Visit onlyplace4's homepage!
 
Reply     « Reply to Image Load Time
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30204 seconds with 12 queries