Results 1 to 6 of 6

Thread: Conveyor belt -repeat function?

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

    Default Conveyor belt -repeat function?

    I was wondering what part of the conveyor belt script makes the pictures loop like that- I want to pik it apart and learn a little.

  2. #2
    Join Date
    Dec 2005
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    What do you mean? I can't understand.

  3. #3
    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

    The basic 'trick' used to make this slideshow continuously looping is that the data for the content (from the array at the top of the script, where you enter your images) is written to two absolutely positioned divisions:

    Code:
    cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
    The left coordinates are then constantly shifted. The one that is not visible, at any given moment, is moved all the way to the 'rear' of the one that is being displayed. When the current one moves off screen the other is already following behind it:

    Code:
    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"
    - John
    ________________________

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

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

    Default makes sense

    If I understand you correctly you are just doubling the content and they follow each other? I was trying to create a similar effect with another script but I think it wouldnt work doubling the content it would make the page load slower. Thanks.

    this is the code I am trying to alter- not similar at all. There is a reset feature but I just want it to loop the content and keep scrolling. I got it to pause (really stop) on mouse over and start again on mouseout.
    I beleive I have to create something that will recognize where the scroller layer is at and when it reaches a particular place- tell it to return to the original coordinates- which means I have to define the original coordinates as variables i guess.

    I am really not a programmer or scriptor. If anyone can point me in the right direction to learn more that would be appreciated.

    CODE
    function P7_HScroller(el,dr,tx,ox,spd) { //v1.7 by PVII
    var g,gg,fr,sp,pa='',slw=true,m=false,w,ww,lx,rx;tx=parseInt(tx);
    if((g=MM_findObj(el))!=null){gg=(document.layers)?g:g.style;}else{return;}
    if(dr=="Stop"){if(g.toMove){clearTimeout(g.p7Magic);}g.toMove=false;}

    if((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1)&& !window.opera){pa="px";}
    if(navigator.userAgent.indexOf("NT")>-1 || navigator.userAgent.indexOf("Windows 2000")>-1){slw=false;}
    //speed settings?
    if(spd=="Slow"){sp=(slw)?2:1;fr=(slw)?40:30;}else if(spd=="Medium"){sp=(slw)?4:1;fr=(slw)?40:10;
    }else{sp=(slw)?8:4;fr=(slw)?40:10;}if(spd=="Warp"){sp=5000;}var xx = parseInt(gg.left);if(isNaN(xx)){
    if(g.currentStyle){xx=parseInt(g.currentStyle.left);}else if(document.defaultView&&document.defaultView.getComputedStyle){
    xx=parseInt(document.defaultView.getComputedStyle(g,"").getPropertyValue("left"));}else{xx=0;}}

    if(document.all || document.getElementById){w=parseInt(g.offsetWidth);if(!w){w=parseInt(g.style.pixelWidth);}
    if(g.hasChildNodes){for(wx=0;wx<g.childNodes.length;wx++){ww=parseInt(g.childNodes[wx].offsetWidth);
    if(ww>w){w=ww;}}}}else if(document.layers){w=parseInt(g.clip.width);}lx=tx-w+parseInt(ox);rx=tx;
    if(dr=="Right"){if(xx>lx){m=true;xx-=sp;if(xx<lx){xx=lx;}}}
    if(dr=="Left"){if(xx<rx){m=true;xx+=sp;if(xx>rx){xx=rx;}}}
    if(dr=="Reset"){gg.left=tx+pa;if(g.toMove){clearTimeout(g.p7Magic);}g.toMove=false;}
    if(m){gg.left=xx+pa;if(g.toMove){clearTimeout(g.p7Magic);}g.toMove=true;
    eval("g.p7Magic=setTimeout(\"P7_HScroller('"+el+"','"+dr+"',"+tx+","+ox+",'"+spd+"')\","+fr+")");
    }else{g.toMove=false;}
    }
    Last edited by hilldomain; 12-17-2005 at 04:01 PM. Reason: more info

  5. #5
    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

    I was trying to create a similar effect with another script but I think it wouldnt work doubling the content it would make the page load slower. Thanks.
    Double text won't add much to page load time unless it is a really huge amount of text. Images, will load much faster the second time, as they are cached and, if not yet visible, can take their time anyway.
    - John
    ________________________

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

  6. #6
    Join Date
    Dec 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with falling snow for beginner

    can anyone explain what I am doing wrong? I am trying to put the falling snowflakes on our web homepage. All I see are falling Square boxes with little no image of the flakes??
    I have saved the snowflake gif to my home files folder which is where I would normally save any images!
    If someone could email me on
    info@thechefshop.net
    I would be very grateful
    Thanks
    Vincent

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
  •