I used the answer to this question to auto-scroll a combat log for my HTML5 game to the bottom:
How to auto-scroll to end of div when data is added?
If I want to briefly disable this while a person clicks to scroll up and view the log, how would I do so?
The Code I'm using is:
//autoscroll combat log
window.setInterval(function() {
var elem = document.getElementById('log');
elem.scrollTop = elem.scrollHeight;
}, 500);
Best regards, Cobwebs
Edit: the code above is connected to a simple span in a div:
<div>
<span id='log'></span>
</div>
Stylized to have a scrollbar:
span#log {
display: block;
font-family: courier, sans;
margin: auto;
border:1px solid black;
width:600px;
height:200px;
overflow:auto;
background-color:black;
color: lime;
text-align: left;
}