Changing multiple images on a dropdown select?

Sophia

Senior member
Apr 26, 2001
680
0
0
I?m interested in making some color swatches where the available image thumbnails for color choices change based on what type of fabric the user selects from a dropdown menu. FabricA might have 5 colors, FabricB 10 colors, FabricC 25 colors, etc.

I don?t particular know javascript, however I understand how to swap a single image at a time (example: http://www.rgagnon.com/jsdetails/js-0057.html )

But what I?d really like to do is load a set of images based on the dropdown select. Can I tell it to load an array of images on select or is that too easy ;) ?
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,836
4,815
75
The first thing I notice is that that example has some really bad javascript. Eval for an index lookup! It should be an array in that example.

We had a thread about animating small images recently. It's really slow with hundreds of copies of one image; but if you take a look at the source code, it might give you some ideas.
 

PhatoseAlpha

Platinum Member
Apr 10, 2005
2,131
21
81
Should be a straightforward multidimensional array. The fabric drop down changes the first dimension, and the color drop down changes the second. With a bit of javascript, it's really no big deal.

You should consider what happens to color on a fabric change though. Does it always revert to a default color, does it attempt to keep the current color if it's in both, and revert to a default if it's not, or what?