PDA

View Full Version : Javascript - moving gallery problem



bullsey
06-22-2008, 05:09 PM
hello

i have a moving javascript gallery and i would like to copy the gallery seven times and place it on the same site, just another position. The pictures the gallery shows are different but the code ist the same.

My problem is now, that just the first gallery shows the pictures and the others are not visible/working.

Do I have to identify each gallery (and how) or what should I do/try ?
Here are my site (http://bullsey3.bu.ohost.de/gil/index.php)

This is an orginal DD-Srcipt, but i forget the name of this script.
And here are my Code:

<script type="text/javascript">


//Specify the slider's width (in pixels)
var sliderwidth="830px"
//Specify the slider's height
var sliderheight="600px"
//Specify the slider's slide speed (larger is faster 1-10)
var slidespeed=2
//configure background color:
slidebgcolor="transparent"

//Specify the slider's images
var leftrightslide=new Array()
var finalslide=''
rightleftslide[0]='<a href="#"><img src="rollerbilder/700/ygm_01_firestorm_black_700_2.jpg" style="border: 5px #fff solid; margin-right: 10px;"></a>'
rightleftslide[1]='<a href="#"><img src="rollerbilder/700/ygm_01_firestorm_blue_700_2.jpg" style="border: 5px #fff solid; margin-right: 10px;"></a>'
leftrightslide[2]='<a href="#"><img src="rollerbilder/700/ygm_01_firestorm_red_700_2.jpg" style="border: 5px #fff solid; margin-right: 10px;"></a>'
leftrightslide[3]='<a href="#"><img src="rollerbilder/700/ygm_01_ice_700_2.jpg" style="border: 5px #fff solid; margin-right: 10px;"></a>'
leftrightslide[4]='<a href="#"><img src="rollerbilder/700/ygm_01_racer_black_700_2.jpg" style="border: 5px #fff solid; margin-right: 10px;"></a>'
leftrightslide[5]='<a href="#"><img src="rollerbilder/700/ygm_01_racer_red_700_2.jpg" style="border: 5px #fff solid; margin-right: 10px;"></a>'
leftrightslide[6]='<a href="#"><img src="rollerbilder/700/ygm_01_racer_black_700_2.jpg" style="border: 5px #fff solid; margin-right: 10px;"></a>'
leftrightslide[7]='<a href="#"><img src="rollerbilder/700/ygm_01_racer_blue_700_2.jpg" style="border: 5px #fff solid; margin-right: 10px;"></a>'



//Specify gap between each image (use HTML):
var imagegap=""

//Specify pixels gap between each slideshow rotation (use integer):
var slideshowgap=0


////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=slidespeed
leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>'
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>')
var actualwidth=''
var cross_slide, ns_slide

function fillup(){
if (iedom){
cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
cross_slide2.style.left=actualwidth+slideshowgap+"px"
}
else if (document.layers){
ns_slide=document.ns_slidemenu.document.ns_slidemenu2
ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
ns_slide.document.write(leftrightslide)
ns_slide.document.close()
actualwidth=ns_slide.document.width
ns_slide2.left=actualwidth+slideshowgap
ns_slide2.document.write(leftrightslide)
ns_slide2.document.close()
}
lefttime=setInterval("slideleft()",30)
}
window.onload=fillup

function slideleft(){
if (iedom){
if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
else
cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px"

if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
else
cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px"

}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+slideshowgap

if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
}
}


if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
if (iedom){
write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">')
write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>')
write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>')
write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('</ilayer>')
}
document.write('</td></table>')
}
}
</script>

Thanks

Nile
06-22-2008, 05:21 PM
Please take a look at this(#4):
http://www.dynamicdrive.com/notice.htm
You are breaking one if the terms of use.
Here is the page that you got that script from, you must leave credit:
http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm

Please post a link to the page on your site that contains the problematic script so we can check it out.
Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

bullsey
06-22-2008, 05:40 PM
i`m sorry, i just reduced the code for clearness.
The copyright is still inside.

please help me.

jscheuer1
06-22-2008, 06:59 PM
rightleftslide[0]
rightleftslide[1]
leftrightslide[2]
leftrightslide[3]
leftrightslide[4]


Are you mildly dyslexic?

jscheuer1
06-22-2008, 07:02 PM
i`m sorry, i just reduced the code for clearness.
The copyright is still inside.

please help me.

I don't see the credit on your page (the one you linked to in your post) either.

Your page is in violation of Dynamic Drive's usage terms (http://www.dynamicdrive.com/notice.htm), which, among other things, state that the script credit must appear in the source code of the page(s) using the script. Please reinstate the notice first.

Also we need that link to the script demo on DD here:

Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

bullsey
06-22-2008, 07:12 PM
it`s inside... but the site was not updatet.. now it is....

I forget name of this DD Script, so i can`t post the name of the DD-Script demo Site..


sry for my bad english...

Nile
06-22-2008, 08:16 PM
You got it from this page:
http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm
Conveyor Belt Slideshow.

bullsey
06-22-2008, 09:34 PM
I tested it with the original DD-Script, if i put the same code on different positions, it does not working...only if i placed it one time.
Can anybody help me? its realy imposible...

jscheuer1
06-23-2008, 12:12 AM
Actually it is working, sort of. You should use your own images though, as Dynamic Drive will block use of their images from a URL offsite. (Dynamic Drive is not an image host)

There are other issues, but using your own images should get the thing working more or less.

One of the other issues is that you have a body onload event:


<body onload="MM_preloadImages('bilder/head_nav_button_01_on.gif','bilder/head_nav_button_02_on.gif','bilder/head_nav_button_03_on.gif','bilder/head_nav_button_04_on.gif')">


That's fine, but it is being overridden by the window.onload of the script:


window.onload=fillup

You should remove:


window.onload=fillup

from the script and add it to your body onload:


<body onload="fillup();MM_preloadImages('bilder/head_nav_button_01_on.gif','bilder/head_nav_button_02_on.gif','bilder/head_nav_button_03_on.gif','bilder/head_nav_button_04_on.gif')">

There appear perhaps to be minor layout issues as well, but these (if any) will only be truly apparent once you have your own images setup with the script.

bullsey
06-23-2008, 03:57 PM
thanks jscheuer1,

i tested it, but only one is working... I can`t setup my own script...
Can anybody show me a script like this, which i can use more then one time?

its realy important ...

jscheuer1
06-23-2008, 04:18 PM
I misunderstood your original question. At least you have one of the shows working now. I also notice that you do not have a:

MM_preloadImages()

function defined for the page. Either get one, or get rid of the call to it in your body tag.

Now, we can forget about onload for the gallery and use this version instead:

http://home.comcast.net/~jscheuer1/side/files/conveyor_oo.htm

It is a multi use OO version of the script. Use your browser's 'view source' to get the well documented code.

However, I must warn you that more than one of these on a page (really more than one in a window -amounts to about the same thing - and sometimes even just more than one open anywhere on the desktop) will cause some browsers and/or systems to not move the images very smoothly.

bullsey
06-24-2008, 03:20 PM
Thanks!!!!!!