misc scrollspy fixes and styling fixes

This commit is contained in:
2025-03-05 14:09:52 +00:00
parent 81623b457c
commit 8b080b2ad8
4 changed files with 51 additions and 19 deletions

View File

@@ -2,31 +2,31 @@ jQuery(function ($) {
// Getting links from a page and turning them into a scroll-spy bespoke menu
// FIXME when page loads with #... in url, the scroll spy gets messed up.
let links;
links = document.querySelectorAll("#one, #two, #three, #four, #fivenav_menu-7")
let sections;
sections = document.querySelectorAll(".add-to-sidebar")
let url = window.location.href;
// Create the correct menu
let innerContent = "";
links.forEach(link => {
let fullUrl = url + "#" + link.id;
innerContent += "<li><a href=\"" + fullUrl + " \" class=''>" + link.attributes.name.value + "</a></li>"
sections.forEach(link => {
let itemTitle = link.querySelector("h2:first-of-type");
if (itemTitle) {
link.setAttribute("id", itemTitle.id)
let fullUrl = url.split("#")[0] + "#" + itemTitle.id;
innerContent += "<li><a href=\"" + fullUrl + " \" class=''>" + itemTitle.innerText + "</a></li>"
}
});
console.log(innerContent)
// Update existing menu with the created one
let menu;
menu = document.getElementById("menu-scroll-spy");
menu.innerHTML = innerContent
// Activate Scrollspy
$('.entry-content').scrollspy({
$('body').scrollspy({
target: '#nav_menu-4'
});
@@ -38,17 +38,14 @@ jQuery(function ($) {
$('[data-spy="scroll"]').each(function () {
$(this).scrollspy("refresh");
});
});
});
document.addEventListener("DOMContentLoaded", function(event) {
var elements = document.querySelectorAll('.view-team-member-button');
elements.forEach(function(element) {
elements.forEach(function(element) {
element.addEventListener('click', function() {
for (elem of document.getElementsByClassName("view-team-member-bio")) {