...

View Full Version : Can anyone help me please...



harisx
01-30-2006, 05:17 AM
What needs to be change to make the images scroll from left to right but still in a continuous loop with no space between the first and last image as the present.

to view example:

http://www.nenganggrek.com/nessypic/scrollertop.htm

here's the code:



<html>

<head>
<title>Scroller</title>
<Script>



var pic = new Array()

function banner(name, width, link){
this.name = name
this.width = width
this.link = link
}

pic[0] = new banner('thumb/70s-01.jpg',90,'nessy/70s-01.html')
pic[1] = new banner('thumb/70s-02.jpg',90,'nessy/70s-02.html')
pic[2] = new banner('thumb/70s-03.jpg',90,'nessy/70s-03.html')
pic[3] = new banner('thumb/80s-01.jpg',90,'nessy/80s-01.html')
pic[4] = new banner('thumb/80s-02.jpg',90,'nessy/80s-02.html')
pic[5] = new banner('thumb/travel-01.jpg',90,'nessy/travel-01.html')
pic[6] = new banner('thumb/travel-02.jpg',90,'nessy/travel-02.html')
pic[7] = new banner('thumb/travel-03.jpg',90,'nessy/travel-03.html')

var speed = 50

var kk = pic.length
var ii
var hhh
var nnn
var myInterval
var myPause


var imgArray = new Array(kk)
var myLeft = new Array(kk)

for (ii=0;ii<kk;ii++){
imgArray[ii] = new Image()
imgArray[ii].src = pic[ii].name
imgArray[ii].width = pic[ii].width

hhh=0
for (nnn=0;nnn<ii;nnn++){
hhh=hhh+pic[nnn].width
}
myLeft[ii] = hhh
}

function ready(){
for (ii=0;ii<kk;ii++){
if (document.images[ii].complete == false){
return false
break
}
}
return true
}


function startScrolling(){
if (ready() == true){
window.clearInterval(myPause)
myInterval = setInterval("autoScroll()",speed)
}
}


function autoScroll(){
for (ii=0;ii<kk;ii++){
myLeft[ii] = myLeft[ii] - 1

if (myLeft[ii] == -(pic[ii].width)){
hhh = 0
for (nnn=0;nnn<kk;nnn++){
if (nnn!=ii){
hhh = hhh + pic[nnn].width
}
}
myLeft[ii] = hhh
}



document.images[ii].style.left = myLeft[ii]
}
}


</Script>

<body bgcolor='#FFFDCF'>
<Script>
for (ii=0;ii<kk;ii++){
document.write('<a href = ' + pic[ii].link + ' target="main" ><img space=0 hspace=0 vspace=0 border=0 height=80px style=position:absolute;top:0;left:' + myLeft[ii] + '; src=' + pic[ii].name + '></a>')
}
myPause = setInterval("startScrolling()",3000)


</Script>



</body>

</html>

glenngv
01-30-2006, 05:29 AM
You may want to consider other slideshow scripts (http://www.dynamicdrive.com/dynamicindex14/index.html) at dynamicdrive especially this one (http://www.dynamicdrive.com/dynamicindex14/carousel2.htm) which was started from here (http://www.codingforums.com/showthread.php?goto=newpost&t=58814).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum