From b18bb3b61036efaeeed31cf68fefb375e97176be Mon Sep 17 00:00:00 2001 From: Nick Krichevsky Date: Mon, 23 Feb 2015 14:08:40 -0500 Subject: [PATCH] Divide window height by two when scrolling down with shift --- popup.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/popup.js b/popup.js index d3ab007..c005b0a 100644 --- a/popup.js +++ b/popup.js @@ -378,7 +378,7 @@ document.addEventListener('DOMContentLoaded', function() { windowKeyIndex+=1; windowList[windowKeyIndex].classList.add('keyHover'); if (windowList[windowKeyIndex].querySelector('span.textContent').getBoundingClientRect().bottom>document.querySelector('body').clientHeight){ - var scrollAmount = windowList[windowKeyIndex].querySelector('span.textContent').getBoundingClientRect().bottom - document.querySelector('body').clientHeight; + var scrollAmount = windowList[windowKeyIndex].querySelector('span.textContent').getBoundingClientRect().bottom - document.querySelector('body').clientHeight/2; scrollBy(0,scrollAmount>windowList[windowKeyIndex].querySelector('span.textContent').clientHeight ? scrollAmount : windowList[windowKeyIndex].querySelector('span.textContent').clientHeight); } } @@ -401,7 +401,6 @@ document.addEventListener('DOMContentLoaded', function() { if (windowList[windowKeyIndex].querySelector('span.textContent').getBoundingClientRect().bottom>=document.querySelector('body').clientHeight){ var scrollAmount = windowList[windowKeyIndex].querySelector('span.textContent').getBoundingClientRect().bottom - document.querySelector('body').clientHeight; scrollBy(0,scrollAmount>windowList[windowKeyIndex].querySelector('span.textContent').clientHeight ? scrollAmount : windowList[windowKeyIndex].querySelector('span.textContent').clientHeight); - console.log("scrolled"); } } }