PDA

View Full Version : Problem integrating Conveyor Belt slideshow script



T.Kick
09-11-2010, 03:11 AM
Hi all,

Script: Conveyor Belt slideshow script

http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm

PROBLEM:
- When I follow the instructions on the page to copy and paste the code, nothing really happens.
- Please see link below (conv-test.html) and the code of the page below that.

- A second link (conv-test-2.html)
- I extracted the slideshow form your page on DD (saved the url)
- Now at least something happens, but not quite without 'errors'
- And it is obvious that there was some (HTML)code missing

Questions:
- Why is it not working 'out-of-the-box' ? Usually there's a piece of HTML-code included in the scripts to include as well, why not in this case ?
- or: Why is the second link not working correctly, what's missing?
- How to avoid situations like this, any tips ?

- For now I'm using DD's Transitional doc-type, but want to change it to HTML 4.01. Would this give any problems? Otherwise Ill just find out, main thing is to get the Belt going .....

-------------------------------------------------------------
http://www.itsall3d.com/test/conv-test.html

-------------------------------------------------

Here an example of the original page on DD, and extracted the slideshow:

http://www.itsall3d.com/test/conv-test-2.html


Hopefully some of you have some clue how to help me out, would be great.

T.Kick
09-11-2010, 04:55 PM
Website was offline yesterday, so today the links should be working again ....

Anyone ?

jscheuer1
09-11-2010, 05:29 PM
In your first example's source code there have somehow been introduced a large number of line breaks into the script that don't belong there. At the same time, these extra line breaks have replaced space characters that do belong. If you change it to:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>Conveyor belt slideshow script-2</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
</head>
<body>
<script
type="text/javascript">
/***********************************************
* Conveyor belt slideshow script- Dynamic Drive DHTML code library
(www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source
code
***********************************************/
//Specify the slider's width (in pixels)
var sliderwidth="300px"
//Specify the slider's height
var sliderheight="150px"
//Specify the slider's slide speed (larger is faster 1-10)
var slidespeed=3
//configure background color:
slidebgcolor="#EAEAEA"
//Specify the slider's images
var leftrightslide=new Array()
var finalslide=''
leftrightslide[0]='<a href="http://"><img src="dynamicbook1.gif" border=1></a>'
leftrightslide[1]='<a href="http://"><img src="dynamicbook2.gif" border=1></a>'
leftrightslide[2]='<a href="http://"><img src="dynamicbook3.gif" border=1></a>'
leftrightslide[3]='<a href="http://"><img src="dynamicbook4.gif" border=1></a>'
leftrightslide[4]='<a href="http://"><img src="dynamicbook5.gif" border=1></a>'
//Specify gap between each image (use HTML):
var imagegap=" "
//Specify pixels gap between each slideshow rotation (use integer):
var slideshowgap=5
////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>')
}

document.write('</td></table>')
}
}
</script>

<p align="center"><font face="Arial" size="-2">Free DHTML
scripts provided by<br>
<a href="http://dynamicdrive.com">Dynamic
Drive</a></font></p></body>

</html>

it will work. But it would better to start over and make sure you don't introduce any of these extra line breaks.

This script should work with any DOCTYPE, though it might not validate. But that's another story.

I don't see any errors on the second page (tested in several browsers). It looks like you tried to repeat the script. I do see what looks like a confused attempt to run two of these conveyors, but that might just be some kind of confusion in copying the code. If you want more than one on a page, I think there is a version that can do that, this one isn't designed for that though.

Bottom line, if you follow the instructions on the demo page and no errors are introduced like in your first link, things will be fine. I have no exact figures, but I imagine that 1000's or more have done so with no problems.

T.Kick
09-11-2010, 05:50 PM
I have no exact figures, but I imagine that 1000's or more have done so with no problems.

No doubt about that, and that's why I was so puzzled ....

Extra line-breaks: I introduced them after the problems occured, to enhance readability ... won't do it again .....

Your example is working indeed ... smoothly .....

thanks