typeit multiple lines shuffled in random order
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
{{- $breakLines := .Get "breakLines" | default true -}}
|
||||
{{- $waitUntilVisible := .Get "waitUntilVisible" | default true -}}
|
||||
{{- $loop := .Get "loop" | default false -}}
|
||||
{{- $randomLines := .Get "randomLines" | default false -}}
|
||||
{{- $classList := slice -}}
|
||||
{{- with .Get "class" -}}
|
||||
{{- $classList = $classList | append . -}}
|
||||
@@ -23,8 +24,15 @@
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
var strings = {{ $content }};
|
||||
{{ if $randomLines }}
|
||||
for (var i = strings.length - 1; i > 0; i--) {
|
||||
var j = Math.floor(Math.random() * (i + 1));
|
||||
[strings[i], strings[j]] = [strings[j], strings[i]];
|
||||
}
|
||||
{{ end }}
|
||||
new TypeIt("#{{ $id }}", {
|
||||
strings: {{ $content }},
|
||||
strings: strings,
|
||||
speed: {{ $speed }},
|
||||
lifeLike: {{ $lifeLike }},
|
||||
startDelay: {{ $startDelay }},
|
||||
|
||||
Reference in New Issue
Block a user