how to hook into page load #8240
-
I'm using
I want to run some javascript each time a new page is loaded. How can I do this? Apparently I should expect some event to be fired when that happens (like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @k4lizen, document$.subscribe(function() {
console.log("Initialize third-party libraries here")
}) Additionally, there are other observables that were made available: mkdocs-material/src/templates/assets/javascripts/bundle.ts Lines 308 to 318 in d205ef5 I think I only used |
Beta Was this translation helpful? Give feedback.
Hi @k4lizen,
like explained on the customization page, you'd subscribe to the
document$
RxJS observable:(see the admonition) https://squidfunk.github.io/mkdocs-material/customization/#additional-javascript
Additionally, there are other observables that were made available:
mkdocs-material/src/templates/assets/javascripts/bundle.ts
Lines 308 to 318 in d205ef5