-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Description
After reviewing the config properties and the code, I expected that it is possible to simply use a HTML element (as a variable) to initialize the library and also pass this element to the stringsElement
config property to keep everything dynamic. However, it seems like typed.js can not use and animate an already existing element, as this is not working:
<!-- Element to contain animated typing -->
<span id="element">Hello world!</span>
<!-- Load library from the CDN -->
<script src="https://unpkg.com/[email protected]/dist/typed.umd.js"></script>
<!-- Setup and start animation! -->
<script>
var el = document.getElementById('element');
var typed = new Typed(el, {
stringsElement: el,
typeSpeed: 60
});
</script>
I also really don't get it, why the following is not working either:
var el = document.getElementById('element');
var typed = new Typed(el, {
strings: [ el.innerHTML ],
typeSpeed: 60
});
Metadata
Metadata
Assignees
Labels
No labels