Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Commit

Permalink
highlighting the latest faq entry
Browse files Browse the repository at this point in the history
  • Loading branch information
dj1ch committed Nov 19, 2023
1 parent 54adf68 commit ec040c5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions components/FAQEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,19 @@ function onClick(ev) {
href.hash = myHash;
window.history.replaceState({}, "", href);
scrollToEntry();
highlightLatestOpened();
}
}
function highlightLatestOpened() {
// Remove highlight from all FAQ entries
const faqEntries = document.querySelectorAll(".faq-entry");
faqEntries.forEach((entry) => entry.classList.remove("latest-opened"));
// Add highlight to the current FAQ entry
entryRef.value.classList.add("latest-opened");
}
onMounted(() => {
checkIsActive();
});
Expand Down Expand Up @@ -98,6 +108,10 @@ a.faq-question {
border-radius: 8px;
}
.faq-entry:hover {
box-shadow: 0 0 10px #409D86;
}
.faq-entry summary {
display: inline;
margin: 0;
Expand Down Expand Up @@ -126,5 +140,14 @@ a.faq-question {
.faq-entry[open] {
color: var(--vp-c-text-1);
border-color: var(--vp-custom-block-tip-border);
border-color: #409D86;
border-width: 2px;
box-shadow: 0 0 10px #409D86;
}
.latest-opened {
border-color: #409D86;
border-width: 2px;
box-shadow: 0 0 10px #409D86;
}
</style>

0 comments on commit ec040c5

Please sign in to comment.