kopia lustrzana https://github.com/shoelace-style/shoelace
prettier
rodzic
d1953b0215
commit
08c074e44b
|
|
@ -211,7 +211,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateActiveLinks() {
|
function updateActiveLinks() {
|
||||||
const links = getLinks()
|
const links = getLinks();
|
||||||
// Find the first visible target and activate the respective link
|
// Find the first visible target and activate the respective link
|
||||||
links.find(link => {
|
links.find(link => {
|
||||||
const target = linkTargets.get(link);
|
const target = linkTargets.get(link);
|
||||||
|
|
@ -226,7 +226,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Observe link targets
|
// Observe link targets
|
||||||
function observeLinks () {
|
function observeLinks() {
|
||||||
getLinks().forEach(link => {
|
getLinks().forEach(link => {
|
||||||
const hash = link.hash.slice(1);
|
const hash = link.hash.slice(1);
|
||||||
const target = hash ? document.querySelector(`.content__body #${hash}`) : null;
|
const target = hash ? document.querySelector(`.content__body #${hash}`) : null;
|
||||||
|
|
@ -238,8 +238,8 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
observeLinks()
|
observeLinks();
|
||||||
|
|
||||||
document.addEventListener("turbo:load", updateActiveLinks)
|
document.addEventListener('turbo:load', updateActiveLinks);
|
||||||
document.addEventListener("turbo:load", observeLinks)
|
document.addEventListener('turbo:load', observeLinks);
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue