Skip to content

how to hook into page load #8240

Answered by kamilkrzyskow
k4lizen asked this question in Q&A
Discussion options

You must be logged in to vote

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

document$.subscribe(function() {
  console.log("Initialize third-party libraries here")
})

Additionally, there are other observables that were made available:

window.document$ = document$ /* Document observable */
window.location$ = location$ /* Location subject */
window.target$ = target$ /* Location target observable */
window.keyboard$ = keyboard$ /* Keyboard observable */

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@k4lizen
Comment options

Answer selected by k4lizen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants