File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ class ScrollspyNav extends Component {
99 this . activeNavClass = this . props . activeNavClass ;
1010 this . scrollDuration = Number ( this . props . scrollDuration ) || 1000 ;
1111 this . headerBackground = this . props . headerBackground === "true" ? true : false ;
12+ this . offset = this . props . offset ;
1213
1314 if ( this . props . router && this . props . router === "HashRouter" ) {
1415 this . homeDefaultLink = "#/" ;
@@ -30,8 +31,8 @@ class ScrollspyNav extends Component {
3031 let change = to - start ,
3132 currentTime = 0 ,
3233 increment = 10 ;
33-
34- let animateScroll = ( ) => {
34+
35+ let animateScroll = ( ) => {
3536 currentTime += increment ;
3637 let val = this . easeInOutQuad ( currentTime , start , change , duration ) ;
3738 window . scrollTo ( 0 , val ) ;
@@ -67,7 +68,7 @@ class ScrollspyNav extends Component {
6768
6869 if ( sectionID ) {
6970 let scrollTargetPosition = document . getElementById ( sectionID ) . offsetTop - ( this . headerBackground ? document . querySelector ( "div[data-nav='list']" ) . scrollHeight : 0 ) ;
70- this . scrollTo ( window . pageYOffset , scrollTargetPosition , this . scrollDuration ) ;
71+ this . scrollTo ( window . pageYOffset , scrollTargetPosition + this . offset , this . scrollDuration ) ;
7172 } else {
7273 this . scrollTo ( window . pageYOffset , 0 , this . scrollDuration ) ;
7374 }
You can’t perform that action at this time.
0 commit comments