diff options
author | Noah Loomans <noahloomans@gmail.com> | 2017-01-30 18:47:56 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2017-01-30 18:47:56 +0100 |
commit | 773584f251b753fb1172cf9b34aaa82ef809ea9d (patch) | |
tree | 3deb4f9fefb8545a8aa1f5acca317f35dd906b72 /public/javascripts/scrollSnap.js | |
parent | 6edf8919a7ea9718405d3ccd0fed2e93ce1e54cc (diff) |
Refactor long lines
Diffstat (limited to 'public/javascripts/scrollSnap.js')
-rw-r--r-- | public/javascripts/scrollSnap.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/public/javascripts/scrollSnap.js b/public/javascripts/scrollSnap.js index 167f0c1..afee979 100644 --- a/public/javascripts/scrollSnap.js +++ b/public/javascripts/scrollSnap.js @@ -12,12 +12,13 @@ self._timeoutID = null self._getScrollPosition = function () { return (document.documentElement && document.documentElement.scrollTop) || - document.body.scrollTop + document.body.scrollTop } self._handleDoneScrolling = function () { const scrollPosition = self._getScrollPosition() - const weekSelectorHeight = self._nodes.weekSelector.clientHeight - self._nodes.search.clientHeight + const weekSelectorHeight = + self._nodes.weekSelector.clientHeight - self._nodes.search.clientHeight if (scrollPosition < weekSelectorHeight && scrollPosition > 0) { window.scroll({ top: weekSelectorHeight, left: 0, behavior: 'smooth' }) } @@ -28,7 +29,8 @@ self._handleScroll = function () { self._timeoutID = window.setTimeout(self._handleDoneScrolling, 500) const scrollPosition = self._getScrollPosition() - const weekSelectorHeight = self._nodes.weekSelector.clientHeight - self._nodes.search.clientHeight + const weekSelectorHeight = + self._nodes.weekSelector.clientHeight - self._nodes.search.clientHeight if (scrollPosition >= weekSelectorHeight) { document.body.classList.add('week-selector-not-visible') } else { @@ -37,8 +39,10 @@ self._handleScroll = function () { } self._handleWindowResize = function () { - const weekSelectorHeight = self._nodes.weekSelector.clientHeight - self._nodes.search.clientHeight - const extraPixelsNeeded = weekSelectorHeight - (document.body.clientHeight - window.innerHeight) + const weekSelectorHeight = + self._nodes.weekSelector.clientHeight - self._nodes.search.clientHeight + const extraPixelsNeeded = + weekSelectorHeight - (document.body.clientHeight - window.innerHeight) if (extraPixelsNeeded > 0) { document.body.style.marginBottom = extraPixelsNeeded + 'px' } else { |