Advanced Search

Results 1 to 8 of 8

Thread: IFRAME scroller

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

    Default IFRAME scroller

    I am looking for some ideas on how to get the scroller to reset to the top of the external document AND have the initialdelay work. Currently the script allows for the initial delay on the first run through only.

    Thanks

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,675
    Thanks
    43
    Thanked 3,125 Times in 3,091 Posts
    Blog Entries
    12

    Default

    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format for asking a question.

    That being said, the solution here, if I understand you, is to change this:
    Code:
    function scrollDiv(){
    dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
    if (parseInt(dataobj.style.top)<thelength*(-1))
    dataobj.style.top="5px"
    setTimeout("scrollDiv()",40)
    }
    to this:
    Code:
    function scrollDiv(){
    dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
    if (parseInt(dataobj.style.top)<thelength*(-1)){
    dataobj.style.top="5px"
    setTimeout("scrollDiv()", initialdelay)
    }
    else
    setTimeout("scrollDiv()",40)
    }
    Enjoy!
    - John
    ________________________

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

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

    Default

    Thanks....didn't seem to work so I likely have not explained well enough. Here's the link to the external.htm file where the script is found. I am looking to have the scroll delay (based on the initialdelay variable) EACH time it is going to scroll through.

    http://www.dynamicdrive.com/dynamicindex2/external.htm

    Thanks for your help.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,675
    Thanks
    43
    Thanked 3,125 Times in 3,091 Posts
    Blog Entries
    12

    Default

    Worked here. I'll paste in the whole file. It is set to 5 second initial delay. It will pause for 5 seconds before each run through.

    HTML Code:
    <!-- External.htm source-->
    <html>
    <body>
    
    <div id="datacontainer" style="position:absolute;left:1px;top:10px;width:100%" onMouseover="scrollspeed=0" onMouseout="scrollspeed=cache">
    
    <!-- ADD YOUR SCROLLER CONTENT INSIDE HERE -->
    
    <b>What's Hot</b></p>
    <p align="left"><strong><font face="Verdana"><small><a href="http://www.dynamicdrive.com/dynamicindex9/encrypter.htm" target="_top">Source
    code encrypter</a>&nbsp;</small></font></strong><br>
    <font face="Verdana" size="2">Scramble the source of any chunk of code using
    this unique script.</font></p>
    <p align="left"><strong><font face="Verdana"><small><a href="http://www.dynamicdrive.com/dynamicindex5/flashlink.htm" target="_top">Flashing
    links</a>&nbsp;</small></font></strong><br>
    <font face="Verdana"><small>Bring attention to special links, by making them
    flash!</small></font></p>
    <p align="left"><small><strong><font face="Verdana"><a href="http://www.dynamicdrive.com/dynamicindex13/roamcursor.htm" target="_top">Roaming
    Cursor</a>&nbsp;</font></strong></small><br>
    <small><font face="Verdana">Display a second, &quot;roaming&quot; cursor on your
    page with this fun animation script.</font></small></p>
    <p align="left"><font face="Verdana"><strong><a href="http://www.dynamicdrive.com/dynamicindex11/animatedtitle.htm" target="_top"><small>Animated
    Document title</small></a><br>
    </strong><small>Animate into view your document's title!</small></font>
    
    <!-- END SCROLLER CONTENT -->
    
    </div>
    
    <script type="text/javascript">
    
    /***********************************************
    * IFRAME Scroller 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 speed of scroll. Larger=faster (ie: 5)
    var scrollspeed=cache=2
    
    //Specify intial delay before scroller starts scrolling (in miliseconds):
    var initialdelay=5000
    
    function initializeScroller(){
    dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
    dataobj.style.top="5px"
    setTimeout("getdataheight()", initialdelay)
    }
    
    function getdataheight(){
    thelength=dataobj.offsetHeight
    if (thelength==0)
    setTimeout("getdataheight()",10)
    else
    scrollDiv()
    }
    
    function scrollDiv(){
    dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
    if (parseInt(dataobj.style.top)<thelength*(-1)){
    dataobj.style.top="5px"
    setTimeout("scrollDiv()", initialdelay)
    }
    else
    setTimeout("scrollDiv()",40)
    }
    
    if (window.addEventListener)
    window.addEventListener("load", initializeScroller, false)
    else if (window.attachEvent)
    window.attachEvent("onload", initializeScroller)
    else
    window.onload=initializeScroller
    
    </script>
    
    </body>
    </html>
    - John
    ________________________

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

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

    Default

    Got it....thanks!

  6. #6
    Join Date
    Mar 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi! I'm not sure if this is the same problem as I am having, but what I am getting is the external file reloading once the scroller has come to the end of the file and what I would like to happen is for the file to just scroll back up again rather than just jumping back into position. Is this possible?

    http://www.spoonofmilk.com/arcproduction/ is the place I am using the script

    Thanks!

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,675
    Thanks
    43
    Thanked 3,125 Times in 3,091 Posts
    Blog Entries
    12

    Default

    I think I see what you are after, the scroller jumps to the top but, you would rather it slide in from the bottom. To get that effect, you can change the top restart position (default of 5px) hard coded into the scrollDiv() function on the external page to be about the height of your iframe on the container page (looked like about 250px to me). In plain English, find this function on latest.html:

    Code:
    function scrollDiv(){
    dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
    if (parseInt(dataobj.style.top)<thelength*(-1))
    dataobj.style.top="5px"
    setTimeout("scrollDiv()",40)
    }
    Change it to this:

    Code:
    function scrollDiv(){
    dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
    if (parseInt(dataobj.style.top)<thelength*(-1))
    dataobj.style.top="255px"
    setTimeout("scrollDiv()",40)
    }
    Last edited by jscheuer1; 03-31-2006 at 02:40 AM.
    - John
    ________________________

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

  8. #8
    Join Date
    Mar 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ahhh wicked! much thanks!

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
  •