Implement pgup/pgdown keys

This commit is contained in:
Pavel Djundik 2017-03-11 12:41:46 +02:00
parent 44f71bb93e
commit 2d9aa35c06

View file

@ -1301,6 +1301,33 @@ $(function() {
});
(function HotkeysScope() {
Mousetrap.bind([
"pageup",
"pagedown"
], function(e, key) {
let container = windows.find(".window.active");
// Chat windows scroll message container
if (container.attr("id") === "chat-container") {
container = container.find(".chan.active .chat");
}
const offset = container.get(0).clientHeight * 0.94;
let scrollTop = container.scrollTop();
if (key === "pageup") {
scrollTop -= offset;
} else {
scrollTop += offset;
}
container.stop().animate({
scrollTop: scrollTop
}, 200);
return false;
});
Mousetrap.bind([
"command+up",
"command+down",