A good sample book showing off the capabilities of PreTeXt:
https://pretextbook.org/examples/sample-article/html/frontma...
Chapter 14 of the sample book covers interactive elements and Javascript:
https://pretextbook.org/examples/sample-article/html/section...