Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zzq0826 committed Jul 3, 2024
1 parent bce282a commit dec9563
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/scripts/has-focused-lines.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
document.addEventListener("DOMContentLoaded", function () {
const preElements = document.querySelectorAll(".expressive-code")
preElements.forEach((pre) => {
const hasTargetClass = pre.querySelector(".highlight")
if (hasTargetClass) {
pre.classList.add("has-focused-lines")
}
document.addEventListener("astro:page-load", () => {
const preElements = document.querySelectorAll(".expressive-code")
preElements.forEach((pre) => {
const hasTargetClass = pre.querySelector(".highlight")
if (hasTargetClass) {
pre.classList.add("has-focused-lines")
}
})
})
})

0 comments on commit dec9563

Please sign in to comment.