g00fy
02-24-2003, 03:47 AM
hi to all, :)
this is my anser to my earlier post and a totally different prob, so i reposted - hope thats OK ?
this is my attempt at a slideshow that is crossbrowser with buttons and timed transition
it works fine in IE but i get no images in NS, although the text does change correctly
this is my code, i give you the lot so you can see wotz goin on, the prob is obviously in the browser detection in the show() method
var halt = false; // true if show stopped
var backward = false; // true when going back through gallery
var activeTimeout = false;
var delay = 10000; // image delay (millisec)
var transition = 3; // transition time (sec)
// array ot hold images
var imgObjects = new Array("images/next.gif",
"images/next_over.gif",
"images/pause.gif",
"images/pause_over.gif",
"images/previous.gif",
"images/previous_over.gif");
var imageArray = new Array();
// array to hold the corresponding images comments :)
var commentArray = new Array("this is the first picture's comment", "this is another picture",
"and yet another picture",
"guess what? here is another",
"and another one",
"and finally the last one");
// the original image and comment from he html page
var img1 = new Image();
img1.src = "images/next.gif";
var origMessage = "this is the title page image";
// browser detection
var ie4=document.all
var ns4=document.layers
var ns6=document.getElementById&&!document.all
//
var a;
var imageNum = 0;
var last = imgObjects.length-1;
var preLoad = new Array();
for (i = 1; i < last + 1; i++){
preLoad[i] = new Image();
preLoad[i].src = imgObjects[i];}
function show(whichWay){
if (whichWay == "start"){
document.images.SlideShow.src = img1.src;
if (document.getElementById){
document.getElementById("gallery").src= img1.src;
document.getElementById("comment").innerHTML= origMessage;
}
halt = true;
if (activeTimeout)
clearTimeout(activeTimeout);
backward = false;
}
if (whichWay == "next"){
imageNum = imageNum + 1;
halt = false;
if (activeTimeout)
clearTimeout(activeTimeout);
backward = false;
}
if (whichWay == "prev"){
imageNum = imageNum - 1;
halt = false;
if (activeTimeout)
clearTimeout(activeTimeout);
backward = true;
}
if (whichWay == "stop"){
imageNum = imageNum;
halt = true;
if (activeTimeout)
clearTimeout(activeTimeout);
backward = false;
}
if (imageNum > (last))
imageNum = 1;
if (imageNum < 1)
imageNum = last;
this is where the problem is
if (!halt){
if (ie4){
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=transition)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[imageNum].src;
if(ns4){
document.gallery.visibility = "show";
document.getElementById("gallery").src= imageArray[imageNum];
document.getElementById("comment").innerHTML= commentArray[imageNum];
}
if (ns6){
document.getElementById("gallery").src= imageArray[imageNum];
document.getElementById("comment").innerHTML= commentArray[imageNum];
}
if (ie4)
document.images.SlideShow.filters.blendTrans.Play();
activeTimeout = setTimeout("show('next');activeTimeout=false", delay);
}
}
thanx to all,
i think after spending hours reading through the posts i might actually be getting somewhere :thumbsup:
kind regards,
g00fy
this is my anser to my earlier post and a totally different prob, so i reposted - hope thats OK ?
this is my attempt at a slideshow that is crossbrowser with buttons and timed transition
it works fine in IE but i get no images in NS, although the text does change correctly
this is my code, i give you the lot so you can see wotz goin on, the prob is obviously in the browser detection in the show() method
var halt = false; // true if show stopped
var backward = false; // true when going back through gallery
var activeTimeout = false;
var delay = 10000; // image delay (millisec)
var transition = 3; // transition time (sec)
// array ot hold images
var imgObjects = new Array("images/next.gif",
"images/next_over.gif",
"images/pause.gif",
"images/pause_over.gif",
"images/previous.gif",
"images/previous_over.gif");
var imageArray = new Array();
// array to hold the corresponding images comments :)
var commentArray = new Array("this is the first picture's comment", "this is another picture",
"and yet another picture",
"guess what? here is another",
"and another one",
"and finally the last one");
// the original image and comment from he html page
var img1 = new Image();
img1.src = "images/next.gif";
var origMessage = "this is the title page image";
// browser detection
var ie4=document.all
var ns4=document.layers
var ns6=document.getElementById&&!document.all
//
var a;
var imageNum = 0;
var last = imgObjects.length-1;
var preLoad = new Array();
for (i = 1; i < last + 1; i++){
preLoad[i] = new Image();
preLoad[i].src = imgObjects[i];}
function show(whichWay){
if (whichWay == "start"){
document.images.SlideShow.src = img1.src;
if (document.getElementById){
document.getElementById("gallery").src= img1.src;
document.getElementById("comment").innerHTML= origMessage;
}
halt = true;
if (activeTimeout)
clearTimeout(activeTimeout);
backward = false;
}
if (whichWay == "next"){
imageNum = imageNum + 1;
halt = false;
if (activeTimeout)
clearTimeout(activeTimeout);
backward = false;
}
if (whichWay == "prev"){
imageNum = imageNum - 1;
halt = false;
if (activeTimeout)
clearTimeout(activeTimeout);
backward = true;
}
if (whichWay == "stop"){
imageNum = imageNum;
halt = true;
if (activeTimeout)
clearTimeout(activeTimeout);
backward = false;
}
if (imageNum > (last))
imageNum = 1;
if (imageNum < 1)
imageNum = last;
this is where the problem is
if (!halt){
if (ie4){
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=transition)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[imageNum].src;
if(ns4){
document.gallery.visibility = "show";
document.getElementById("gallery").src= imageArray[imageNum];
document.getElementById("comment").innerHTML= commentArray[imageNum];
}
if (ns6){
document.getElementById("gallery").src= imageArray[imageNum];
document.getElementById("comment").innerHTML= commentArray[imageNum];
}
if (ie4)
document.images.SlideShow.filters.blendTrans.Play();
activeTimeout = setTimeout("show('next');activeTimeout=false", delay);
}
}
thanx to all,
i think after spending hours reading through the posts i might actually be getting somewhere :thumbsup:
kind regards,
g00fy