Raised This Month: $51 Target: $400
 12% 

Preloading images


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BadAim
Senior Member
Join Date: Feb 2006
Location: canada
Old 01-15-2008 , 19:14   Preloading images
Reply With Quote #1

Hi,

i am making a website right now and i am using MouseOver to make an effect on my buttons. When i open my page, the images dont preload and it takes a small second before it appear. This is the original javascript, and in few webbrowsers, the javascript is blocked. I would like to make it in php or another web language, so everyone will preload the images correctly.

So, someone knows something good for preloading images?

thanks
BadAim is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 01-16-2008 , 15:57   Re: Preloading images
Reply With Quote #2

http://www.google.co.uk/search?q=pre...ient=firefox-a
Lee is offline
chris-1337
Senior Member
Join Date: Jan 2008
Location: The United Kingdom Of Gr
Old 01-16-2008 , 16:52   Re: Preloading images
Reply With Quote #3

My personal advice is to use CSS (Cascading Style Sheets) and then define the image to 0px height & width, they load but do not get shown, then when you use whatever effects to display/hide them, they should be preloaded. =)
__________________
Microsoft Word has encountered an error.
As a result of this your bank account has been emptied, your credit cards maxed out & your family has been brutally murdered.
Thank-you for using Microsoft Products.
chris-1337 is offline
Send a message via MSN to chris-1337
BadAim
Senior Member
Join Date: Feb 2006
Location: canada
Old 01-16-2008 , 17:46   Re: Preloading images
Reply With Quote #4

but how can i display 2 images in the same frame. i think we cant stack an image on the other.
BadAim is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 01-16-2008 , 21:55   Re: Preloading images
Reply With Quote #5

The first result of my search describes in detail exactly how to preload rollover images using JavaScript. The second result uses CSS. Just in case someone feels I'm still a dick for helping you, I'll even supply a script you can copy and paste without having read the helpful resources I have pointed out. It's not as if having an understanding of how web pages work will help you write them.

Code:
<script>

/*
Preload images script
By JavaScript Kit (http://javascriptkit.com)
Over 400+ free scripts here!
*/

var myimages=new Array()
function preloadimages(){
for (i=0;i<preloadimages.arguments.length;i++){
myimages[i]=new Image()
myimages[i].src=preloadimages.arguments[i]
}
}


//Enter path of images to be preloaded inside parenthesis. Extend list as desired.
preloadimages("http://mydomain.com/firstimage.gif","http://mydomain.com/secondimage.gif","http://mydomain.com/thirdimage.gif")

</script>

Last edited by Lee; 01-16-2008 at 21:59.
Lee is offline
BadAim
Senior Member
Join Date: Feb 2006
Location: canada
Old 01-16-2008 , 22:13   Re: Preloading images
Reply With Quote #6

i know the html code but the javascript is a bit much longer to learn...

that javascript to the same thing that mines do, i dont know why but when you put the mouse on the button, it takes a small seocnd before the second image appear, it dont do that when i run it directly on my computer bcause the files are already loaded, but i want to do the same on the net.

Edit: just click on my website link in my sig and you'll see by yourself what i mean.

Last edited by BadAim; 01-16-2008 at 22:15.
BadAim is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 01-16-2008 , 22:50   Re: Preloading images
Reply With Quote #7

It would seem you have not used the snippet correctly. Copy and paste the one I gave you; it's simpler. Remember to actually place the images' location in the function call.
Lee is offline
BadAim
Senior Member
Join Date: Feb 2006
Location: canada
Old 01-16-2008 , 23:04   Re: Preloading images
Reply With Quote #8

where exactly, do i have to add something in the code?
BadAim is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 01-16-2008 , 23:23   Re: Preloading images
Reply With Quote #9

Code:
//Enter path of images to be preloaded inside parenthesis. Extend list as desired.
preloadimages("http://mydomain.com/firstimage.gif","http://mydomain.com/secondimage.gif","http://mydomain.com/thirdimage.gif")
Lee is offline
BadAim
Senior Member
Join Date: Feb 2006
Location: canada
Old 01-17-2008 , 08:37   Re: Preloading images
Reply With Quote #10

and i need to add each image of my website 1 by 1?
BadAim is offline
Reply



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 10:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode