File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed
src/scaladoc/scala/tools/nsc/doc/html/resource/lib Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -113,20 +113,26 @@ function handleKeyNavigation() {
113
113
scroller . container = $container ;
114
114
115
115
scroller . scrollDown = function ( $elem ) {
116
- var yPos = $elem . offset ( ) . top ; // offset relative to viewport
117
- if ( $container . height ( ) < yPos || ( yPos - $ ( "#search" ) . height ( ) ) < 0 ) {
118
- $container . animate ( {
119
- scrollTop : $container . scrollTop ( ) + yPos - $ ( "#search" ) . height ( ) - 10
120
- } , 200 ) ;
116
+ var offset = $elem . offset ( ) ; // offset relative to viewport
117
+ if ( offset !== undefined ) {
118
+ var yPos = offset . top ;
119
+ if ( $container . height ( ) < yPos || ( yPos - $ ( "#search" ) . height ( ) ) < 0 ) {
120
+ $container . animate ( {
121
+ scrollTop : $container . scrollTop ( ) + yPos - $ ( "#search" ) . height ( ) - 10
122
+ } , 200 ) ;
123
+ }
121
124
}
122
125
} ;
123
126
124
127
scroller . scrollUp = function ( $elem ) {
125
- var yPos = $elem . offset ( ) . top ; // offset relative to viewport
126
- if ( yPos < $ ( "#search" ) . height ( ) ) {
127
- $container . animate ( {
128
- scrollTop : $container . scrollTop ( ) + yPos - $ ( "#search" ) . height ( ) - 10
129
- } , 200 ) ;
128
+ var offset = $elem . offset ( ) ; // offset relative to viewport
129
+ if ( offset !== undefined ) {
130
+ var yPos = offset . top ;
131
+ if ( yPos < $ ( "#search" ) . height ( ) ) {
132
+ $container . animate ( {
133
+ scrollTop : $container . scrollTop ( ) + yPos - $ ( "#search" ) . height ( ) - 10
134
+ } , 200 ) ;
135
+ }
130
136
}
131
137
} ;
132
138
You can’t perform that action at this time.
0 commit comments