Skip to content

Commit 1f5a093

Browse files
authored
IBX-5857: Fix tall right ToC (#281)
1 parent 451efb0 commit 1f5a093

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

docs/css/navigation.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
padding-left: 10px;
5858
padding-bottom: 10px;
5959
padding-top: 7rem;
60+
height: calc(100vh - 138px);
61+
}
62+
63+
.md-nav--secondary .md-nav__title {
64+
position: relative;
6065
}
6166

6267
.md-nav--secondary>ul {

docs/js/custom.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,25 @@ $(document).ready(function() {
133133

134134
$('.md-sidebar--primary .md-sidebar__scrollwrap')[0].scrollTop =
135135
$('.md-sidebar--primary .md-nav__item--active:not(.md-nav__item--nested)')[0].offsetTop - 33;
136+
137+
$(document).scroll(function() {
138+
if ($('.md-sidebar--secondary .md-nav__link--active').length) {
139+
$('.md-sidebar--secondary .md-nav__link--active')[0].scrollIntoView({
140+
behavior: 'instant',
141+
block: 'nearest'
142+
});
143+
} else {
144+
$('.md-sidebar--secondary .md-sidebar__scrollwrap').scrollTop(0);
145+
}
146+
});
147+
148+
$('.md-sidebar.md-sidebar--secondary nav a').click(function(event) {
149+
window.setTimeout(function() {
150+
$('.md-sidebar--secondary .md-nav__link--active').removeClass('md-nav__link--active');
151+
$(event.target).addClass('md-nav__link--active');
152+
$(document).scroll();
153+
// Fix page TOC/hash bug
154+
document.location.hash = event.target.hash;
155+
}, 500);
156+
});
136157
});

0 commit comments

Comments
 (0)