Update dokka docs to v1.16.4_R19
This commit is contained in:
@@ -4,6 +4,7 @@ filteringContext = {
|
||||
activeFilters: []
|
||||
}
|
||||
let highlightedAnchor;
|
||||
let topNavbarOffset;
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
document.querySelectorAll("div[data-platform-hinted]")
|
||||
@@ -18,6 +19,11 @@ window.addEventListener('load', () => {
|
||||
initTabs()
|
||||
handleAnchor()
|
||||
initHidingLeftNavigation()
|
||||
|
||||
document.getElementById('main').addEventListener("scroll", (e) => {
|
||||
document.getElementsByClassName("navigation-wrapper")[0].classList.toggle("sticky-navigation", e.target.scrollTop > 0)
|
||||
})
|
||||
topNavbarOffset = document.getElementById('navigation-wrapper')
|
||||
})
|
||||
|
||||
const initHidingLeftNavigation = () => {
|
||||
@@ -38,6 +44,27 @@ const initHidingLeftNavigation = () => {
|
||||
// If this is not present user is forced to refresh the site in order to use an anchor
|
||||
window.onhashchange = handleAnchor
|
||||
|
||||
function scrollToElementInContent(element){
|
||||
const scrollToElement = () => document.getElementById('main').scrollTo({ top: element.offsetTop - topNavbarOffset.offsetHeight, behavior: "smooth"})
|
||||
|
||||
const waitAndScroll = () => {
|
||||
setTimeout(() => {
|
||||
if(topNavbarOffset){
|
||||
scrollToElement()
|
||||
} else {
|
||||
waitForScroll()
|
||||
}
|
||||
}, 50)
|
||||
}
|
||||
|
||||
if(topNavbarOffset){
|
||||
scrollToElement()
|
||||
} else {
|
||||
waitAndScroll()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function handleAnchor() {
|
||||
if(highlightedAnchor){
|
||||
highlightedAnchor.classList.remove('anchor-highlight')
|
||||
@@ -64,7 +91,8 @@ function handleAnchor() {
|
||||
content.classList.add('anchor-highlight')
|
||||
highlightedAnchor = content
|
||||
}
|
||||
element.scrollIntoView({behavior: "smooth"})
|
||||
|
||||
scrollToElementInContent(element)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -260,4 +288,3 @@ function refreshFilterButtons() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user