Skip to content
This repository was archived by the owner on Apr 28, 2020. It is now read-only.

Commit a1d5921

Browse files
author
Chris Ferdinandi
committed
Merge pull request #36 from follesoe/master
Add `offsettTop` to `offsetHeigh`t for `scrollHeader`. Allows for multiple fixed headers, or a fixed header that sits slightly below the top of the page.
2 parents 36c3256 + b533570 commit a1d5921

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

smooth-scroll.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ window.smoothScroll = (function (window, document, undefined) {
4747

4848
// Get the height of a fixed header if one exists
4949
var scrollHeader = document.querySelector('[data-scroll-header]');
50-
var headerHeight = scrollHeader === null ? 0 : scrollHeader.offsetHeight;
50+
var headerHeight = scrollHeader === null ? 0 : (scrollHeader.offsetHeight + scrollHeader.offsetTop);
5151

5252
// Set the animation variables to 0/undefined.
5353
var timeLapsed = 0;

0 commit comments

Comments
 (0)