I have following code for Typed.js (https://github.com/mattboldt/typed.js/)
js
$(function(){
$("h2").typed({
strings: ["This should stay forever. ", "Loop Element 1", "Loop Element 2", "Loop Element 3"],
typeSpeed: 0,
loop: true
});
});
html
<h2></h2>
css
body{background: #000; color: lime; }
.typed-cursor{opacity: 0; display:none; }
It's running in a loop at the moment. Here is my code CodePen.io
I want it to run it in loop but I want the first element to appear as it is appearing at the moment. Once it appears I want it to stay and then rest of the elements will be typing in and out and they will be in the loop.
update:
Just figured out answer. Here is what I am doing
js
$(function(){
$("h2 .first").typed({
strings: ["This should stay forever. "],
typeSpeed: 0,
callback: function() {
showThis();
},
});
function showThis(){
$("span.second").typed({
strings: ["Loop Element 1", "Element 2 Here", "New Element 3", "Element # 4"],
backDelay: 1500,
typeSpeed: 100,
backSpeed: 100,
loop: true,
});
}
});
css
body{background: #000; color: lime; }
.typed-cursor{
display:none;
}
HTML
<h2><span class="first"></span><span class="second"></span></h2>
Here is the pencode: PenCode