I want in all my scrolling divs to remove the scroll bar-quite easy through css, so now how to scroll the contents? After some searching I have found the following code which works perfectly
However in this example the user must keep pressing the links/images to navigate, I want to do this by simply hovering the mouse above them (I tried simply changing the events but the it worked spartialy-when I place the mouse above the down link it goes down only once and not continiously )
any help? (Also note that I want to keep the structure of fuctions with arguments since in the same page I will have multiple divs)
Code:
<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
<script type="text/javascript">
<!--
defaultStep=1
step=defaultStep
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 stopMe(){
clearTimeout(timerDown)
clearTimeout(timerUp)
}
document.onmousemove=function(){stopMe()}
// -->
</script>
</HEAD>
<BODY>
<P></P>
<div id="div1" style="width:200px; height:300px; overflow:hidden">
<b>LAYER CONTENTS</b>
<P>Some Text<P>SOME TEXT<P>Some Text<P>SOME TEXT
<P>Some Text<P>SOME TEXT<P>Some Text<P>SOME TEXT
<P>Some Text<P>SOME TEXT<P>Some Text<P>SOME TEXT
<P>Some Text<P>SOME TEXT<P>Some Text<P>End
</div>
<P></P>
<a href="#null" onMouseDown="scrollDivDown('div1')" onMouseUp="stopMe()">ScrollDown</a>
<a href="#null" onMouseDown="scrollDivUp('div1')" onmouseup="stopMe()">Scroll Up</a>
<img src="images/arrowdown.gif" onMouseDown="scrollDivDown('div1')" onMouseUp="stopMe()"/>
<img src="images/arrowup.gif" onMouseDown="scrollDivUp('div1')" onMouseUp="stopMe()"/>
</BODY>
</HTML>
any help? (Also note that I want to keep the structure of fuctions with arguments since in the same page I will have multiple divs)
Comment