Results 1 to 5 of 5

Thread: Conveyor Belt slideshow - randomized

  1. #1
    Join Date
    Aug 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Conveyor Belt slideshow - randomized

    Conveyor Belt slideshow script

    http://www.dynamicdrive.com/dynamici...rightslide.htm

    I love this script but I want the images randomized so that each time a user comes to the site they don't see the same first 3 photos before moving on to other sections.

    Thanks.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    An excellent array randomizer was written by Mike (mwinter) from these forums. It is still available here. What you do is place the unit after the array, in this case the 'leftrightslide' array. A good place would be just after this line in the Conveyor Belt slideshow script:
    Code:
    ////NO NEED TO EDIT BELOW THIS LINE////////////
    Then after the unit put this:
    Code:
    leftrightslide.shuffle()
    Then each time the page loads, a random order will be assigned to the array and thus the order of the images shown.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Nice! That was a snap to implement.

    The whole unit is now running great in a core phpnuke block. Randomized now too

    Thanks!

  4. #4
    Join Date
    May 2008
    Posts
    144
    Thanks
    6
    Thanked 11 Times in 11 Posts

    Default

    anyone got a way to continuously randomize the slides? and also to make sure slides dont repeat?

  5. #5
    Join Date
    May 2008
    Posts
    144
    Thanks
    6
    Thanked 11 Times in 11 Posts

    Default

    i got something... not completely continuous, but it gets the job done...
    Code:
    /***********************************************
    * 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="860px"
    //Specify the slider's height
    var sliderheight="136px"
    //Specify the slider's slide speed (larger is faster 1-10)
    var slidespeed=2
    //configure background color:
    slidebgcolor="#F0FFF0"
    
    //Specify the slider's images
    var randomslides=new Array()
    var finalslide=''
    randomslides[0]='<img src="images/slideshow/IMG_0907.jpg">'
    randomslides[1]='<img src="images/slideshow/IMG_0916.jpg">'
    randomslides[2]='<img src="images/slideshow/IMG_0934.jpg">'
    randomslides[3]='<img src="images/slideshow/IMG_0928.jpg">'
    randomslides[4]='<img src="images/slideshow/IMG_0989.jpg">'
    randomslides[5]='<img src="images/slideshow/IMG_0998.jpg">'
    
    
    var leftrightslide = new Array();
    //MultiRandomizer by AJ Pinto thenajsays@gmail.com
    function MultiRandomizer()
    {
    	var p = new Array();
    	
    	for (i = 0; i < 99; i++)
    	{
    		var n = Math.floor(Math.random() * 6);
    		leftrightslide[i] = randomslides[n];
    		if(n != p[0] && n != p[1] && n != p[2])
    		{
    			leftrightslide[i] = randomslides[n];
    			p[0] = p[1];
    			p[1] = p[2];
    			p[2] = n;
    		}
    		else
    		{
    			while (n == p[0] || n == p[1] || n == p[2])
    			{
    				n = Math.floor(Math.random() * 6);
    			}
    				leftrightslide[i] = randomslides[n];
    				p[0] = p[1];
    				p[1] = p[2];
    				p[2] = n;
    		}
    
    	}
    }
    //End MultiRandomizer
    
    //Specify gap between each image (use HTML):
    var imagegap=""
    
    //Specify pixels gap between each slideshow rotation (use integer):
    var slideshowgap=0
    MultiRandomizer();
    
    ////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+'"')
    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"></layer>')
    write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0"></layer>')
    write('</ilayer>')
    }
    document.write('</td></table>')
    }
    }

Bookmarks

Posting Permissions

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