only scroll the log window if it was already scrolled to the bottom

This commit is contained in:
Andy Janata 2011-12-24 19:38:19 -08:00
parent 37cc770ed3
commit 29d3ca9190
1 changed files with 4 additions and 1 deletions

View File

@ -7,8 +7,11 @@
cah.log = {};
cah.log.status = function(text) {
var scroll = $("#log").prop("scrollHeight") - $("#log").height() - $("#log").prop("scrollTop") <= 5;
$("#log").append("[" + new Date().toLocaleTimeString() + "] " + text + "<br/>");
$("#log").prop("scrollTop", $("#log").prop("scrollHeight"));
if (scroll) {
$("#log").prop("scrollTop", $("#log").prop("scrollHeight"));
}
};
cah.log.error = function(text) {