hiding-header
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -41,4 +41,6 @@ function hidingHeader(container, _a) { | ||
}; | ||
var capBoundsHeight = function (rawBoundsHeight) { | ||
return Math.min(getParentHeight() - getRelativeTopOffset(), Math.max(getContentHeight(), rawBoundsHeight)); | ||
}; | ||
var onScroll = function () { | ||
var parentHeight = getParentHeight(); | ||
var globalTopOffset = getGlobalTopOffset(); | ||
@@ -55,4 +57,3 @@ // Handle content height | ||
if (!paused) { | ||
var maxBoundsHeight = parentHeight - getRelativeTopOffset(); | ||
var boundsHeight = Math.min(maxBoundsHeight, Math.max(contentHeight, (function () { | ||
var boundsHeight = capBoundsHeight((function () { | ||
if (isScrollingDown) { | ||
@@ -72,3 +73,3 @@ var newBoundsHeight = scrollTopPosition - globalTopOffset; | ||
} | ||
})())); | ||
})()); | ||
updateBoundsHeight(boundsHeight); | ||
@@ -97,5 +98,4 @@ } | ||
var contentHeight = getContentHeight(); | ||
var maxBoundsHeight = getParentHeight() - getRelativeTopOffset(); | ||
var globalTopOffset = getGlobalTopOffset(); | ||
var boundsHeight = Math.min(maxBoundsHeight, scrollTopPosition - globalTopOffset + contentHeight); | ||
var boundsHeight = capBoundsHeight(scrollTopPosition - globalTopOffset + contentHeight); | ||
animateOffset(lastBoundsHeight - boundsHeight); | ||
@@ -106,5 +106,4 @@ updateBoundsHeight(boundsHeight); | ||
var scrollTopPosition = window.scrollY; | ||
var contentHeight = getContentHeight(); | ||
var globalTopOffset = getGlobalTopOffset(); | ||
var boundsHeight = Math.max(contentHeight, scrollTopPosition - globalTopOffset); | ||
var boundsHeight = capBoundsHeight(scrollTopPosition - globalTopOffset); | ||
animateOffset(lastBoundsHeight - boundsHeight); | ||
@@ -111,0 +110,0 @@ updateBoundsHeight(boundsHeight); |
@@ -45,4 +45,6 @@ 'use strict'; | ||
}; | ||
var capBoundsHeight = function (rawBoundsHeight) { | ||
return Math.min(getParentHeight() - getRelativeTopOffset(), Math.max(getContentHeight(), rawBoundsHeight)); | ||
}; | ||
var onScroll = function () { | ||
var parentHeight = getParentHeight(); | ||
var globalTopOffset = getGlobalTopOffset(); | ||
@@ -59,4 +61,3 @@ // Handle content height | ||
if (!paused) { | ||
var maxBoundsHeight = parentHeight - getRelativeTopOffset(); | ||
var boundsHeight = Math.min(maxBoundsHeight, Math.max(contentHeight, (function () { | ||
var boundsHeight = capBoundsHeight((function () { | ||
if (isScrollingDown) { | ||
@@ -76,3 +77,3 @@ var newBoundsHeight = scrollTopPosition - globalTopOffset; | ||
} | ||
})())); | ||
})()); | ||
updateBoundsHeight(boundsHeight); | ||
@@ -101,5 +102,4 @@ } | ||
var contentHeight = getContentHeight(); | ||
var maxBoundsHeight = getParentHeight() - getRelativeTopOffset(); | ||
var globalTopOffset = getGlobalTopOffset(); | ||
var boundsHeight = Math.min(maxBoundsHeight, scrollTopPosition - globalTopOffset + contentHeight); | ||
var boundsHeight = capBoundsHeight(scrollTopPosition - globalTopOffset + contentHeight); | ||
animateOffset(lastBoundsHeight - boundsHeight); | ||
@@ -110,5 +110,4 @@ updateBoundsHeight(boundsHeight); | ||
var scrollTopPosition = window.scrollY; | ||
var contentHeight = getContentHeight(); | ||
var globalTopOffset = getGlobalTopOffset(); | ||
var boundsHeight = Math.max(contentHeight, scrollTopPosition - globalTopOffset); | ||
var boundsHeight = capBoundsHeight(scrollTopPosition - globalTopOffset); | ||
animateOffset(lastBoundsHeight - boundsHeight); | ||
@@ -115,0 +114,0 @@ updateBoundsHeight(boundsHeight); |
{ | ||
"name": "hiding-header", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Toggles header visibility on scroll.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
28816
248