Skip to content

Commit

Permalink
IBX-5857: Fix tall right ToC (#2338)
Browse files Browse the repository at this point in the history
(cherry picked from commit a517588)
  • Loading branch information
adriendupuis committed Apr 2, 2024
1 parent 11cbad6 commit 557701e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/css/navigation.css
Expand Up @@ -57,6 +57,11 @@
padding-left: 10px;
padding-bottom: 10px;
padding-top: 7rem;
height: calc(100vh - 138px);
}

.md-nav--secondary .md-nav__title {
position: relative;
}

.md-nav--secondary>ul {
Expand Down
18 changes: 16 additions & 2 deletions docs/js/custom.js
Expand Up @@ -145,12 +145,26 @@ $(document).ready(function() {
$('.md-sidebar--primary .md-nav__item--active:not(.md-nav__item--nested)')[0].offsetTop - 33;
}

// Fix page TOC/hash bug
$(document).scroll(function() {
if ($('.md-sidebar--secondary .md-nav__link--active').length) {
$('.md-sidebar--secondary .md-nav__link--active')[0].scrollIntoView({
behavior: 'instant',
block: 'nearest'
});
} else {
$('.md-sidebar--secondary .md-sidebar__scrollwrap').scrollTop(0);
}
});

$('.md-sidebar.md-sidebar--secondary nav a').click(function(event) {
window.setTimeout(function() {
$('.md-sidebar--secondary .md-nav__link--active').removeClass('md-nav__link--active');
$(event.target).addClass('md-nav__link--active');
$(document).scroll();
// Fix page TOC/hash bug
document.location.hash = event.target.hash;
}, 500);
})
});

document.querySelectorAll('.notification__close-btn').forEach((closeBtn) => {
closeBtn.addEventListener('click', () => {
Expand Down

0 comments on commit 557701e

Please sign in to comment.