- commit
- 5b002082708d846db0f5c4330ef1a37873a42838
- parent
- 6e6c7af5e3d08c36ff4d03bc6ff240759071046a
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2016-11-18 18:15
fixed header
Diffstat
| M | TODO | 1 | - |
| M | smooth-scroll.js | 9 | ++++++++- |
2 files changed, 8 insertions, 2 deletions
diff --git a/TODO b/TODO
@@ -1,4 +1,3 @@1 -1 - fixed header support2 1 - standards compliant 3 2 - change direction mid-scroll 4 3 ! merge upstream
diff --git a/smooth-scroll.js b/smooth-scroll.js
@@ -40,9 +40,16 @@ 40 40 }, duration); 41 41 }; 42 4243 -1 var init = function() {-1 43 var init = function(headerSelector) { -1 44 var header = document.querySelector(headerSelector || '[data-scroll-header]'); -1 45 44 46 var scroll = function(selector) { 45 47 var scrollY = document.querySelector(selector).offsetTop; -1 48 -1 49 if (header) { -1 50 scrollY -= header.getBoundingClientRect().height; -1 51 } -1 52 46 53 smoothScrollTo(scrollY); 47 54 }; 48 55