feat(theme/book): Scroll to top when clicking the page title (#613)
Common pattern, especially on mobile devices where the page can be quite long.
This commit is contained in:
parent
2989096188
commit
990daceed5
|
@ -220,6 +220,7 @@ html:not(.sidebar-visible) #menu-bar:not(:hover).folded > #menu-bar-sticky-conta
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
-o-text-overflow: ellipsis;
|
-o-text-overflow: ellipsis;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.nav-chapters {
|
.nav-chapters {
|
||||||
font-size: 2.5em;
|
font-size: 2.5em;
|
||||||
|
|
|
@ -522,6 +522,14 @@ function playpen_text(playpen) {
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
(function scrollToTop () {
|
||||||
|
var menuTitle = document.querySelector('.menu-title');
|
||||||
|
|
||||||
|
menuTitle.addEventListener('click', function () {
|
||||||
|
document.scrollingElement.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
(function autoHideMenu() {
|
(function autoHideMenu() {
|
||||||
var menu = document.getElementById('menu-bar');
|
var menu = document.getElementById('menu-bar');
|
||||||
|
|
||||||
|
|
|
@ -38,4 +38,5 @@ html:not(.sidebar-visible) #menu-bar:not(:hover).folded > #menu-bar-sticky-conta
|
||||||
white-space: nowrap
|
white-space: nowrap
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
text-overflow: ellipsis
|
text-overflow: ellipsis
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue