summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2013-11-19 19:39:43 +0000
committerEndi S. Dewata <edewata@redhat.com>2013-11-19 19:39:43 +0000
commit28545042084a2f4212b2d97c267a267aae47d55f (patch)
tree83dda4d44818745109706dfb33d1838748434621 /js
parentdc462298527fd0fca2bb7cc3f62bbaf4e0956b67 (diff)
downloadcli-demo-28545042084a2f4212b2d97c267a267aae47d55f.tar.gz
cli-demo-28545042084a2f4212b2d97c267a267aae47d55f.tar.xz
cli-demo-28545042084a2f4212b2d97c267a267aae47d55f.zip
Fixed scrollbar.
Diffstat (limited to 'js')
-rw-r--r--js/terminal-animation.js29
1 files changed, 18 insertions, 11 deletions
diff --git a/js/terminal-animation.js b/js/terminal-animation.js
index f43fce1..28f1833 100644
--- a/js/terminal-animation.js
+++ b/js/terminal-animation.js
@@ -69,18 +69,15 @@
$this.content.append(list);
}
- $this.flush();
+ $this.flush(function() {
+ $this.console.scrollTop(0);
+ });
};
- $this.flush = function() {
- var done = function() {
- var height = $this.console.height();
- $this.console.scrollTop(height);
- };
-
+ $this.flush = function(done) {
var run = function() {
if ($this.elements.contents().length == 0) {
- done.call();
+ if (done) done.call();
return;
}
@@ -125,7 +122,11 @@
$this.elements.prepend(element);
}
- $this.flush();
+ $this.flush(function() {
+ var height = $this.content.height();
+ $this.console.scrollTop(height);
+ });
+
};
$this.next = function(callback) {
@@ -160,14 +161,20 @@
} else {
$this.content.append(element);
- $this.flush();
+ $this.flush(function() {
+ var height = $this.content.height();
+ $this.console.scrollTop(height);
+ });
if (callback) callback.call();
}
};
$this.reset = function() {
$this.elements.append($this.content.contents().detach());
- $this.flush();
+ $this.flush(function() {
+ var height = $this.content.height();
+ $this.console.scrollTop(height);
+ });
};
$this.init();