JavaScript - How Do I Set Autoscroll Using Dyn-web?
Hi,
On my page, I have a horizontal scroller which activates onMouseOver, I would like this to automatically start when teh page is loaded, when this reaches the end, it then scrolls the other way?! demo: http://www.dyn-web.com/code/scroll/horiz.php JavaScript Code http://www.dyn-web.com/code/scroll/js/dw_scroll.js thanks Similar TutorialsHello everyone, What I'm trying to do just doesn't seem like it should be that difficult but I'm sure struggling with lacking skills I should say. I'm trying to automatically scroll a div up and down. For say if div.scrollTop = 0 then scroll to the bottom once it reaches the bottom scroll back up and so forth not stopping in a loop with say a timeout of 10.. Just need help putting it all together. Any input is much appreciated!! I've figured some stuff out: I can tell if I'm at the bottom of the scrollable area with: PHP Code: (document.getElementById(id).clientHeight + document.getElementById(id).scrollTop) - document.getElementById(id).scrollHeight Or if I'm at the top of the scrollable area if: PHP Code: document.getElementById(id).scrollTop = 0 psuedo: PHP Code: function scrollDivDown(id){ clearTimeout(timerDown) document.getElementById(id).scrollTop+=step timerDown=setTimeout("scrollDivDown('"+id+"')",10) } function scrollDivUp(id){ clearTimeout(timerUp) document.getElementById(id).scrollTop-=step timerUp=setTimeout("scrollDivUp('"+id+"')",10) } timerDown="" timerUp="" function scrollMe(id){ var iScrollHeight = document.getElementById(id).scrollHeight var iScrollTop = document.getElementById(id).scrollTop var iClientHeight = document.getElementById(id).clientHeight var iPOS = (iClientHeight + iScrollTop) - iScrollHeight if (iPOS < 0) { scrollDivDown(id) } else if (iPOS = 0) { scrollDivUp(id) } Hi, I am using the code: Code: function ScrollFW(){ self.scrollBy(0,3) } function playScrollFW(){ bTmp=setInterval('ScrollFW()',5) } window.onload=playScrollFW and it auto scrolls the page to the end and stops. I'd like the autoscrolling to stop once a user clicks anywhere on the page. Any ideas please? Thanks |