misc scrollspy fixes and styling fixes

This commit is contained in:
Nataliia Bobrova 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 // 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; let sections;
sections = document.querySelectorAll(".add-to-sidebar")
links = document.querySelectorAll("#one, #two, #three, #four, #fivenav_menu-7")
let url = window.location.href; let url = window.location.href;
// Create the correct menu
let innerContent = ""; let innerContent = "";
sections.forEach(link => {
links.forEach(link => { let itemTitle = link.querySelector("h2:first-of-type");
let fullUrl = url + "#" + link.id; if (itemTitle) {
innerContent += "<li><a href=\"" + fullUrl + " \" class=''>" + link.attributes.name.value + "</a></li>" 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; let menu;
menu = document.getElementById("menu-scroll-spy"); menu = document.getElementById("menu-scroll-spy");
menu.innerHTML = innerContent menu.innerHTML = innerContent
// Activate Scrollspy // Activate Scrollspy
$('.entry-content').scrollspy({ $('body').scrollspy({
target: '#nav_menu-4' target: '#nav_menu-4'
}); });
@ -38,17 +38,14 @@ jQuery(function ($) {
$('[data-spy="scroll"]').each(function () { $('[data-spy="scroll"]').each(function () {
$(this).scrollspy("refresh"); $(this).scrollspy("refresh");
}); });
});
});
document.addEventListener("DOMContentLoaded", function(event) { document.addEventListener("DOMContentLoaded", function(event) {
var elements = document.querySelectorAll('.view-team-member-button'); var elements = document.querySelectorAll('.view-team-member-button');
elements.forEach(function(element) {
elements.forEach(function(element) {
element.addEventListener('click', function() { element.addEventListener('click', function() {
for (elem of document.getElementsByClassName("view-team-member-bio")) { for (elem of document.getElementsByClassName("view-team-member-bio")) {

View File

@ -21,11 +21,31 @@
} }
} }
/* Is required to show the svg logo */ /* Is required to show the svg logo */
.navbar-brand { .navbar-brand {
width: 150px; width: 150px;
} }
.offcanvas-body #bootscore-navbar {
li {
border-top: 1px dotted #fff;
padding: 0.5rem 0;
&:last-of-type {
border-bottom: 1px dotted #fff;
}
}
}
@include media-breakpoint-up(lg) {
.offcanvas-body #bootscore-navbar {
li,
li:last-of-type {
border-color: transparent;
}
}
}
/* CUSTOM BLOCK MOBILE SUPPORT */ /* CUSTOM BLOCK MOBILE SUPPORT */
@include media-breakpoint-up(md) { @include media-breakpoint-up(md) {
@ -181,6 +201,7 @@
#sidebar { #sidebar {
// padding-left: 8rem; // padding-left: 8rem;
// padding-right: 2rem; // padding-right: 2rem;
top: 30px;
font-size: 24px; font-size: 24px;
position: sticky; position: sticky;
a:not(.active) { a:not(.active) {
@ -188,7 +209,6 @@
} }
li { li {
border-top: 1px dotted #000; border-top: 1px dotted #000;
// border-bottom:
padding: 0.5rem 0; padding: 0.5rem 0;
&:last-of-type { &:last-of-type {
border-bottom: 1px dotted #000; border-bottom: 1px dotted #000;
@ -392,3 +412,11 @@ body:not(.wp-admin) .wp-block-group.team {
} }
} }
.add-to-sidebar {
position: relative;
height: 100%;
}
body:not(.wp-admin) {
--wp--style--global--content-size: 100%;
}

View File

@ -65,3 +65,9 @@ $container-max-widths: (
xl: 1140px, xl: 1140px,
xxl: 1400px xxl: 1400px
); );
$offcanvas-bg-color: $primary;
$offcanvas-color: #fff;

View File

@ -229,4 +229,5 @@ add_action( 'init', 'register_list_block_popout' );
function my_fancy_filter_function() { function my_fancy_filter_function() {
return "featured-full-width-img bg-dark text-light mb-5"; return "featured-full-width-img bg-dark text-light mb-5";
} }
add_filter('bootscore/class/featured-full-width-img', 'my_fancy_filter_function', 10, 2); add_filter('bootscore/class/featured-full-width-img', 'my_fancy_filter_function', 10, 2);