mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Add fragment IDs to site FAQs
This commit is contained in:
@@ -265,6 +265,11 @@ body {
|
|||||||
.faq {
|
.faq {
|
||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq:target {
|
||||||
|
border-color: var(--blue-50) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.faq__summary {
|
.faq__summary {
|
||||||
@@ -275,6 +280,7 @@ body {
|
|||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.faq__content {
|
.faq__content {
|
||||||
max-width: 70rem;
|
max-width: 70rem;
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
|
|||||||
@@ -1,5 +1,19 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
// Set FAQ fragment IDs
|
||||||
|
for (const faq of document.querySelectorAll(".faq")) {
|
||||||
|
const summary = faq.querySelector(".faq__summary");
|
||||||
|
const formattedSummary = summary.textContent.trim().replace(/ /g, "_");
|
||||||
|
|
||||||
|
faq.id = formattedSummary;
|
||||||
|
|
||||||
|
if (window.location.hash) {
|
||||||
|
faq.open = decodeURIComponent(
|
||||||
|
window.location.hash.slice(1)) === formattedSummary;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function updateThemeClass (mediaQuery) {
|
function updateThemeClass (mediaQuery) {
|
||||||
if (mediaQuery.matches) {
|
if (mediaQuery.matches) {
|
||||||
document.documentElement.classList.remove("theme-dark");
|
document.documentElement.classList.remove("theme-dark");
|
||||||
|
|||||||
Reference in New Issue
Block a user