FIX: position view on j+k keyboard shortcuts

This commit is contained in:
TK 2016-04-10 14:00:15 +02:00
parent 9536200703
commit 18a0a15c75

@ -327,15 +327,17 @@ export default {
// Try to keep the article on screen
const pos = $article.offset();
const height = $article.height();
const headerHeight = $('header.d-header').height();
const scrollTop = $(window).scrollTop();
const windowHeight = $(window).height();
// skip if completely on screen
if (pos.top > scrollTop && (pos.top + height) < (scrollTop + windowHeight)) {
if ((pos.top - headerHeight) > scrollTop && (pos.top + height) < (scrollTop + windowHeight)) {
return;
}
let scrollPos = (pos.top + (height/2)) - (windowHeight * 0.5);
if (height > (windowHeight - headerHeight)) { scrollPos = (pos.top - headerHeight); }
if (scrollPos < 0) { scrollPos = 0; }
if (this._scrollAnimation) {