File tree 4 files changed +19
-4
lines changed
4 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ $(function () {
13
13
if ( ! ! initialHash ) {
14
14
setTimeout ( function ( ) {
15
15
animateScrolling ( initialHash ) ;
16
- } , 100 ) ;
16
+ } , 200 ) ;
17
17
}
18
18
19
19
$ ( "#markdown-toc" )
Original file line number Diff line number Diff line change 1
1
function animateScrolling ( hash ) {
2
+ var isApiSection = $ ( "article.api-reference" ) . length == 1 ;
3
+ var breadCrumbsElement = $ ( "p.breadcrumbs" ) ;
4
+ var hasBreadCrumbs = breadCrumbsElement . length == 1 && breadCrumbsElement . text ( ) . trim ( ) != "" ;
2
5
var currentScrollTop = $ ( window ) . scrollTop ( ) ;
3
6
var offset = $ ( hash ) . offset ( ) || { top : currentScrollTop } ;
4
- var scrollOffsetCorrection = currentScrollTop == 0 ? HEADER_HEIGHT + NAVBAR_HEIGHT : NAVBAR_HEIGHT ;
7
+
8
+ var scrollOffsetCorrection = NAVBAR_HEIGHT ;
9
+ if ( currentScrollTop == 0 ) {
10
+ scrollOffsetCorrection += HEADER_HEIGHT ;
11
+ if ( hasBreadCrumbs ) {
12
+ scrollOffsetCorrection += BREADCRUMBS_HEIGHT ;
13
+ }
14
+ if ( isApiSection ) {
15
+ scrollOffsetCorrection += API_SCROLL_FIX ;
16
+ }
17
+ }
5
18
6
19
$ ( 'html, body' ) . animate ( {
7
20
scrollTop : offset . top - scrollOffsetCorrection
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ $(function() {
58
58
if ( ! ! initialHash ) {
59
59
setTimeout ( function ( ) {
60
60
animateScrolling ( initialHash ) ;
61
- } , 100 ) ;
61
+ } , 200 ) ;
62
62
}
63
63
64
64
// animated scroll
Original file line number Diff line number Diff line change 1
- var HEADER_HEIGHT = 100 ;
1
+ var HEADER_HEIGHT = 81 ;
2
2
var TELERIKBAR_HEIGHT = 70 ;
3
3
var NAVBAR_HEIGHT = 76 ;
4
+ var BREADCRUMBS_HEIGHT = 20 ;
5
+ var API_SCROLL_FIX = 40 ;
4
6
var SCROLLSPY_OFFSET = TELERIKBAR_HEIGHT + 10 ; // 10 compensates for the space above the anchored heading
5
7
var FOOTER_DISTANCE = 20 ;
6
8
var windowHeight = Math . max ( document . documentElement . clientHeight , window . innerHeight || 0 ) ;
You can’t perform that action at this time.
0 commit comments