|
|
Multiple Image Javascript Swapping Question.
|
|
|
|
Mac Elite
Join Date: Nov 1999
Status:
Offline
|
|
http://www.jamesmeister.com/1914/
I'm working on something for the company I work for where the main image of the dress changes colors when you click the swatch on the right.
Problem is, I cannot find a script anywhere that does this. Does anyone know how, or have a script I can modify to accomplish this?
Thank you!
|
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Oct 2003
Status:
Offline
|
|
What you have seems to be working... but the images to swap you have specified do not exist... for exampe, clicking the darkest swatch in the lower corner, attempts to place in the image http://www.jamesmeister.com/d67f5cd6...2c1.normal.jpg which does not exist, so it either appears to not work, or you get the ? square.
|
The only thing necessary for evil to flourish is for good men to do nothing
- Edmund Burke
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Nov 1999
Status:
Offline
|
|
if you look at the actual script in the top of the HTML it doesn't seem to be the script I need as it looks like it's looking for color codes etc.
I adapted another bridal page into this one so I think I need a 100% different script.
|
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status:
Offline
|
|
This is the function you're using:
Code:
function changeImage(newSrc,newColorID){
document.productImage_noPreload.src = "/" + newSrc;
if(newColorID){
colorID = newColorID;
}
}
Change it to:
Code:
function changeImage(newSrc){
document.getElementById("productImage_noPreload").src = newSrc;
}
and it should work.
The only real problem with the original is that it had the forward slash, so it was looking at the root of your server - the images are in the current folder the page is in, so you don't need it. Oh, and since you're not using the colorID thingy, I took that out too.
You might want to specify all the images in an array and preload them then just choose the image src from the array. Just a thought
|
Just who are Britain? What do they? Who is them? And why?
Formerly Black Book
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Nov 1999
Status:
Offline
|
|
Thank you, thank you, thank you... works perfectly now
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|