Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Page Auto Scroll Problem

  1. #1
    Join Date
    Jul 2008
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Page Auto Scroll Problem

    Hi
    I have a very simple problem but I do not know how to fix it.

    I am using the auto scroll script from the below page
    http://www.dynamicdrive.com/dynamicindex8/topscroll.htm

    On page refresh it automatically scrol down the page and then
    scroll up to top and then again scroll down and then again move up to Top and keep scrolling the page from top to down and then up and then down(LOOP process)


    :: What I want ::
    I want to just automatically scroll down the page and do not scroll up to Top again. DONE!

    OR

    After scrolling down wait for some 2 minutes and then auto scroll the page up to Top


    Below is the script that I am using
    Please some one fix this for me.

    ===============================================
    <script language="JavaScript1.2">

    /*
    Top-Down scrolling window Script- © Dynamic Drive (www.dynamicdrive.com)
    For full source code, visit http://www.dynamicdrive.com
    This notice MUST stay intact for use
    */

    //change 1 to another integer to alter the scroll speed. Greater is faster
    var speed=1
    var currentpos=0,alt=1,curpos1=0,curpos2=-1
    function initialize(){
    startit()
    }

    function iecompattest(){
    return (document.compatMode!="BackCompat")? document.documentElement : document.body
    }

    function scrollwindow(){
    if (document.all)
    temp=iecompattest().scrollTop
    else
    temp=window.pageYOffset
    if (alt==0)
    alt=1
    else
    alt=0
    if (alt==0)
    curpos1=temp
    else
    curpos2=temp
    if (curpos1!=curpos2){
    if (document.all)
    currentpos=iecompattest().scrollTop+speed
    else
    currentpos=window.pageYOffset+speed
    window.scroll(0,currentpos)
    }
    else{
    currentpos=0
    window.scroll(0,currentpos)
    }
    }
    function startit(){
    setInterval("scrollwindow()",10)
    }
    window.onload=initialize
    </script>
    ========================================================

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    If you hate it going to top again, then remove the higlighted:
    Code:
    function scrollwindow(){
    if (document.all)
    temp=iecompattest().scrollTop
    else
    temp=window.pageYOffset
    if (alt==0)
    alt=1
    else
    alt=0
    Hope it helps.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Jul 2008
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi

    I am removed the highlighted as you said but it is still not working.

    Can some one fix the Auto Scroll to top problem?

  4. #4
    Join Date
    Jul 2008
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Hi

    I am removed the highlighted as you said but it is still not working.

    Please, Can some one fix the Auto Scroll to top problem??

  5. #5
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    My apologies for not being with the thread. I've got a lot of work, anyway, that was my bad. Try to remove highlighted instead:
    Code:
    function scrollwindow(){
    if (document.all)
    temp=iecompattest().scrollTop
    else
    temp=window.pageYOffset
    if (alt==0)
    alt=1
    else
    alt=0
    if (alt==0)
    curpos1=temp
    else
    curpos2=temp
    if (curpos1!=curpos2){
    if (document.all)
    currentpos=iecompattest().scrollTop+speed
    else
    currentpos=window.pageYOffset+speed
    window.scroll(0,currentpos)
    }
    else{
    currentpos=0
    window.scroll(0,currentpos)
    }
    }
    Hope it helps.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  6. #6
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    1st of all, i,m apologize for my bad english.
    i just want to know, how about to make it scroll down at the some place and stop? i really need this trick. thanks

  7. #7
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Here's a modified version of the script:
    Code:
    <script type="text/javascript">
    
    /*
    Top-Down scrolling window Script- © Dynamic Drive (www.dynamicdrive.com)
    For full source code, visit http://www.dynamicdrive.com
    Modified by Raymond Angana
    rangana in dynamicdrive.com/forums
    This notice MUST stay intact for use
    */
    
    //change 1 to another integer to alter the scroll speed. Greater is faster
    var speed=1
    var currentpos=0,alt=1,curpos1=0,curpos2=-1,
    limit=100; // Set the limit here
    function initialize(){
    startit()
    }
    
    function iecompattest(){
    return (document.compatMode!="BackCompat")? document.documentElement : document.body
    }
    
    function scrollwindow(){
    if (document.all)
    temp=iecompattest().scrollTop
    else
    temp=window.pageYOffset
    if (alt==0)
    alt=1
    else
    alt=0
    if (alt==0)
    curpos1=temp
    else
    curpos2=temp
    if (curpos1!=curpos2){
    if (document.all)
    {
    currentpos=(currentpos==limit)?iecompattest().scrollTop:iecompattest().scrollTop+speed;
    }
    else
    currentpos=(currentpos==limit)?window.pageYOffset:window.pageYOffset+speed;
    window.scroll(0,currentpos)
    }
    }
    function startit(){
    setInterval("scrollwindow()",10)
    }
    window.onload=initialize
    </script>
    Modifications were:
    1. Added a limit (Highlighted sets the limit).
    2. Scrolling stops on the set limit.


    Hope that helps.
    Last edited by rangana; 07-23-2008 at 06:33 AM. Reason: Forgot to highlight
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  8. #8
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ooo thanks rangana. i will try it.

  9. #9
    Join Date
    Dec 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need help

    After the script scrolls down to the area set in the limit. Is there a way to make ti terminate so that people can scroll through the page without the autoscroll interfering? Basically, I went it to autoscroll once to the area set in the limit then stop and no more autoscrolling happens again unless the page is refreshed. Can someone help?

  10. #10
    Join Date
    Apr 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help please!

    i am trying to use that script too but i would like a small change to it.

    it is good as it is, i don't mind it scrolling to the bottom, but i would like the scrolling to stop once someone is clicking anywhere on the page.

    That would be so great !

    Your help is much appreciated.

    BlackM00N

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
  •