Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can anyone help me please...

    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:
    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>

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You may want to consider other slideshow scripts at dynamicdrive especially this one which was started from here.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •