Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8ab24b2e
Commit
8ab24b2e
authored
May 08, 2019
by
Julien Palard
Committed by
Stéphane Wirtel
May 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.7] bpo-24712: Doc: Make sidebar sticky using browser support. (GH-13179)
Patch by Mike Taylor.
parent
7c2c01f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
Doc/tools/static/sidebar.js
Doc/tools/static/sidebar.js
+12
-0
No files found.
Doc/tools/static/sidebar.js
View file @
8ab24b2e
...
@@ -46,6 +46,15 @@ $(function() {
...
@@ -46,6 +46,15 @@ $(function() {
var
dark_color
=
$
(
'
.related
'
).
css
(
'
background-color
'
);
var
dark_color
=
$
(
'
.related
'
).
css
(
'
background-color
'
);
var
light_color
=
$
(
'
.document
'
).
css
(
'
background-color
'
);
var
light_color
=
$
(
'
.document
'
).
css
(
'
background-color
'
);
// set position: sticky on sidebar
// (browsers that don't support this will fall-back to
// positioning via scroll_sidebar)
var
supportsPositionSticky
=
(
window
.
CSS
&&
window
.
CSS
.
supports
&&
window
.
CSS
.
supports
(
'
position
'
,
'
sticky
'
));
if
(
supportsPositionSticky
)
{
sidebarwrapper
.
css
(
'
position
'
,
'
sticky
'
);
}
function
get_viewport_height
()
{
function
get_viewport_height
()
{
if
(
window
.
innerHeight
)
if
(
window
.
innerHeight
)
return
window
.
innerHeight
;
return
window
.
innerHeight
;
...
@@ -157,6 +166,9 @@ $(function() {
...
@@ -157,6 +166,9 @@ $(function() {
/* intelligent scrolling */
/* intelligent scrolling */
function
scroll_sidebar
()
{
function
scroll_sidebar
()
{
if
(
supportsPositionSticky
)
{
return
;
}
var
sidebar_height
=
sidebarwrapper
.
height
();
var
sidebar_height
=
sidebarwrapper
.
height
();
var
viewport_height
=
get_viewport_height
();
var
viewport_height
=
get_viewport_height
();
var
offset
=
sidebar
.
position
()[
'
top
'
];
var
offset
=
sidebar
.
position
()[
'
top
'
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment