Entering text animation

Just wondering if anyone can help with the problem I have.

I have a working "Text Changer" and it works great. The problem I'm running into is that I want the changing text to print itself. Below I have attached a JS script of a working script.

<h1 class="intro-title">This is some text 
<span id="changer">This text changes</span></h1>

<script>    var words = ["changes to this", "changes to that", "changes   to there"];
var i = 0;
var text = "This text changes";
function _getChangedText() {
  i = (i + 1) % words.length;
  return text.replace(/This text changes/, words[i]);
}
function _changeText() {
  var txt = _getChangedText();
  document.getElementById("changer").innerHTML = txt;
}
setInterval("_changeText()", 1800);</script>

      

https://jsfiddle.net/g59phn0b/ - Current Code

I have also added a link to what I would like to do.

https://jsfiddle.net/7K3UE/ - Desired effect

If anyone can help, it would be greatly appreciated.

+3


source to share


1 answer


You can use the jquery plugin for this. Check it out typed.js

.



Here's the link: http://www.mattboldt.com/demos/typed-js/

+1


source







All Articles