Use JS to show/hide railroad diagrams based on page width (thanks @hober!)
This commit is contained in:
parent
44f11c6792
commit
84c7c714ed
4 changed files with 77 additions and 19 deletions
8
layouts/shortcodes/scripts/railroad.html
Normal file
8
layouts/shortcodes/scripts/railroad.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
{{- $parentID := .Parent.Get "id" -}}
|
||||
{{- $narrowOnly := .Get "narrow" }}
|
||||
<script defer type="module">
|
||||
import { railroadDiagram } from {{ `/scripts/railroad-utils.js` | relURL }};
|
||||
railroadDiagram(rr => {
|
||||
{{ .Inner | safeJS }}
|
||||
}, "{{ $parentID }}", {{ if $narrowOnly }}true{{ else }}false{{ end }});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue