Merge pull request #1244 from thelounge/xPaw/fix-page-keys

Correctly finish scroll animation when using page keys
This commit is contained in:
Jérémie Astori 2017-06-20 23:25:32 -04:00 committed by GitHub
commit d09ac7ae13

View File

@ -1306,15 +1306,14 @@ $(function() {
"pagedown" "pagedown"
], function(e, key) { ], function(e, key) {
let container = windows.find(".window.active"); let container = windows.find(".window.active");
if (container.is(":animated")) {
return;
}
// Chat windows scroll message container // Chat windows scroll message container
if (container.attr("id") === "chat-container") { if (container.attr("id") === "chat-container") {
container = container.find(".chan.active .chat"); container = container.find(".chan.active .chat");
} }
container.finish();
const offset = container.get(0).clientHeight * 0.9; const offset = container.get(0).clientHeight * 0.9;
let scrollTop = container.scrollTop(); let scrollTop = container.scrollTop();
@ -1324,7 +1323,7 @@ $(function() {
scrollTop = Math.ceil(scrollTop + offset); scrollTop = Math.ceil(scrollTop + offset);
} }
container.stop().animate({ container.animate({
scrollTop: scrollTop scrollTop: scrollTop
}, 200); }, 200);