Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Multiple Image Javascript Swapping Question.

Multiple Image Javascript Swapping Question.
Thread Tools
Mac Guru
Mac Elite
Join Date: Nov 1999
Status: Offline
Reply With Quote
Jul 31, 2005, 12:50 PM
 
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!
"The young people of America need be taught that the only pride they may properly hold is in the content of their character, and the achievements they make. There is no legitimate pride or moral credit to be gained by virtue of sharing the same race with a great and admirable individual. "

My Website
     
madmacgames
Grizzled Veteran
Join Date: Oct 2003
Status: Offline
Reply With Quote
Jul 31, 2005, 01:43 PM
 
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 Guru  (op)
Mac Elite
Join Date: Nov 1999
Status: Offline
Reply With Quote
Jul 31, 2005, 02:32 PM
 
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.
"The young people of America need be taught that the only pride they may properly hold is in the content of their character, and the achievements they make. There is no legitimate pride or moral credit to be gained by virtue of sharing the same race with a great and admirable individual. "

My Website
     
Chris O'Brien
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status: Offline
Reply With Quote
Aug 1, 2005, 09:48 AM
 
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 Guru  (op)
Mac Elite
Join Date: Nov 1999
Status: Offline
Reply With Quote
Aug 1, 2005, 11:11 AM
 
Thank you, thank you, thank you... works perfectly now
"The young people of America need be taught that the only pride they may properly hold is in the content of their character, and the achievements they make. There is no legitimate pride or moral credit to be gained by virtue of sharing the same race with a great and admirable individual. "

My Website
     
   
Thread Tools
 
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -4. The time now is 12:33 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,