File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,15 @@ $(function() {
46
46
var dark_color = $ ( '.related' ) . css ( 'background-color' ) ;
47
47
var light_color = $ ( '.document' ) . css ( 'background-color' ) ;
48
48
49
+ // set position: sticky on sidebar
50
+ // (browsers that don't support this will fall-back to
51
+ // positioning via scroll_sidebar)
52
+ var supportsPositionSticky = ( window . CSS && window . CSS . supports &&
53
+ window . CSS . supports ( 'position' , 'sticky' ) ) ;
54
+ if ( supportsPositionSticky ) {
55
+ sidebarwrapper . css ( 'position' , 'sticky' ) ;
56
+ }
57
+
49
58
function get_viewport_height ( ) {
50
59
if ( window . innerHeight )
51
60
return window . innerHeight ;
@@ -157,6 +166,9 @@ $(function() {
157
166
158
167
/* intelligent scrolling */
159
168
function scroll_sidebar ( ) {
169
+ if ( supportsPositionSticky ) {
170
+ return ;
171
+ }
160
172
var sidebar_height = sidebarwrapper . height ( ) ;
161
173
var viewport_height = get_viewport_height ( ) ;
162
174
var offset = sidebar . position ( ) [ 'top' ] ;
You can’t perform that action at this time.
0 commit comments