plain-reload: Scroll down at document load.
When visiting the tail-reload page, for a short amount of time the "unscrolled" version is shown. To circumvent that, let's scroll down immediately at the first possibility to fill the gap between the loading of the document and the first AJAX request coming in. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
parent
c251598241
commit
7a48ad375a
|
@ -9,18 +9,23 @@
|
|||
|
||||
[% IF reload %]
|
||||
<script>
|
||||
function scrollDown() {
|
||||
$("#contents").scrollTop($("#contents").get(0).scrollHeight);
|
||||
}
|
||||
|
||||
function injectTail() {
|
||||
$.ajax({
|
||||
url: "[% url %]",
|
||||
dataType: "text",
|
||||
success: function (tail) {
|
||||
$("#contents").text(tail);
|
||||
$("#contents").scrollTop($("#contents").get(0).scrollHeight);
|
||||
scrollDown();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
scrollDown();
|
||||
injectTail();
|
||||
setInterval(injectTail, 5000);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue