I'm not quite sure how I would go about doing this. I've searched for ways to scroll to a point within a div, but I've only been able to find methods for doing this within the window (and not the div).
Does anyone know how to auto-scroll to a certain point within a div? And when I say auto-scroll, I mean like smooth scrolling.
Here's the code I have right now. I just don't know what to add to it.
Code:<script type="text/javascript"> var t; var doLoop = true; function scrollDivToTop(divid) { var div = document.getElementById(divid); if (div.scrollTop>0 && doLoop) { div.scrollTop-=3; t = setTimeout("scrollDivToTop('" + divid + "')", 1); } else clearTimeout(t); } function scrollDivToBottom(divid) { var div = document.getElementById(divid); if (div.scrollTop<999999999 && doLoop) { div.scrollTop+=3; t = setTimeout("scrollDivToBottom('" + divid + "')", 1); } else clearTimeout(t); } function stop() { doLoop = false; setTimeout('doLoop = true;', 5); } </script>



Reply With Quote


Bookmarks