djr33
03-13-2007, 03:30 AM
1) Script Title: Swiss Army Slideshow
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/swissarmy/index.htm
3) Describe problem: No problem. Trying to set the images dynamically onMouseover.
I want to dynamically change the images when a viewer of the site clicks on an image below (thumbnails).
The idea of this gallery is to show different aspects of the production of the movie I'm working on, so I want to fade through without any manual controls, something like would happen with flash. The options I have set are right. The gallery was working except that I tried to make it dynamic.
Here's my idea:
setgallery(name):
called once onLoad, blank, setting the default.
called again onMouseover from any link/image on the rest of the page (not to worry... nothing complex about setting it from within the slideshow itself, though this might not be hard, anyway.)
This function sets the slides array with the values from another array, based on the name value and on the previously set array of the same value.
Here's the code for what I have changed:
<script type="text/javascript">
//If using image buttons as controls, Set image buttons' image preload here true
//(use false for no preloading and for when using no image buttons as controls):
var preload_ctrl_images=false;
//And configure the image buttons' images here:
var previmg='left.gif';
var stopimg='stop.gif';
var playimg='play.gif';
var nextimg='right.gif';
//config for each gallery by name
var imgs = [];
imgs['test'][0] = ["test0.jpg"];
imgs['test'][1] = ["test1.jpg"];
imgs['test'][2] = ["test2.jpg"];
imgs['def'][0] = ["def0.jpg"];
imgs['def'][1] = ["def1.jpg"];
var slides=[];
function setgallery(name) {
if (name == "") {
name = "test";
}
slides = imgs[name];
//optional properties for these images:
slides.controls_top=0; //use for top controls
slides.counter=0; //use to show image count
slides.width=640; //use to set width of widest image if dimensions vary
slides.height=320; //use to set height of tallest image if dimensions vary
slides.no_auto=0; //use to make show completely user operated (no play button, starts in stopped mode)
slides.use_alt=0; //use for descriptions as images alt attributes
slides.use_title=0; //use for descriptions as images title attributes
slides.nofade=0; //use for no fade-in, fade-out effect for this show
slides.border=0; //set border width for images
slides.border_color='lightblue'; //set border color for images
slides.no_descriptions=1;
slides.random=0;
slides.no_controls=1;
};
</script>
I could put a demo page up, but there is no point as nothing happens right now. I'm sure I did something wrong in setting it and it'll be a fairly easy fix.
Also, can I remove the img loading stuff at the top since I don't want any controls at all?
Thanks, and sorry for my lack of knowledge about JS. At least I tried.
EDIT:
By the way, the three errors I get with the FF javascript console:
images.test has no properties (from above code)
imgs has no properties (from swissarmy.js)
slides has no properties (from above code)
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/swissarmy/index.htm
3) Describe problem: No problem. Trying to set the images dynamically onMouseover.
I want to dynamically change the images when a viewer of the site clicks on an image below (thumbnails).
The idea of this gallery is to show different aspects of the production of the movie I'm working on, so I want to fade through without any manual controls, something like would happen with flash. The options I have set are right. The gallery was working except that I tried to make it dynamic.
Here's my idea:
setgallery(name):
called once onLoad, blank, setting the default.
called again onMouseover from any link/image on the rest of the page (not to worry... nothing complex about setting it from within the slideshow itself, though this might not be hard, anyway.)
This function sets the slides array with the values from another array, based on the name value and on the previously set array of the same value.
Here's the code for what I have changed:
<script type="text/javascript">
//If using image buttons as controls, Set image buttons' image preload here true
//(use false for no preloading and for when using no image buttons as controls):
var preload_ctrl_images=false;
//And configure the image buttons' images here:
var previmg='left.gif';
var stopimg='stop.gif';
var playimg='play.gif';
var nextimg='right.gif';
//config for each gallery by name
var imgs = [];
imgs['test'][0] = ["test0.jpg"];
imgs['test'][1] = ["test1.jpg"];
imgs['test'][2] = ["test2.jpg"];
imgs['def'][0] = ["def0.jpg"];
imgs['def'][1] = ["def1.jpg"];
var slides=[];
function setgallery(name) {
if (name == "") {
name = "test";
}
slides = imgs[name];
//optional properties for these images:
slides.controls_top=0; //use for top controls
slides.counter=0; //use to show image count
slides.width=640; //use to set width of widest image if dimensions vary
slides.height=320; //use to set height of tallest image if dimensions vary
slides.no_auto=0; //use to make show completely user operated (no play button, starts in stopped mode)
slides.use_alt=0; //use for descriptions as images alt attributes
slides.use_title=0; //use for descriptions as images title attributes
slides.nofade=0; //use for no fade-in, fade-out effect for this show
slides.border=0; //set border width for images
slides.border_color='lightblue'; //set border color for images
slides.no_descriptions=1;
slides.random=0;
slides.no_controls=1;
};
</script>
I could put a demo page up, but there is no point as nothing happens right now. I'm sure I did something wrong in setting it and it'll be a fairly easy fix.
Also, can I remove the img loading stuff at the top since I don't want any controls at all?
Thanks, and sorry for my lack of knowledge about JS. At least I tried.
EDIT:
By the way, the three errors I get with the FF javascript console:
images.test has no properties (from above code)
imgs has no properties (from swissarmy.js)
slides has no properties (from above code)