Typewriter effect | XM Community
Solved

Typewriter effect

  • 29 August 2020
  • 4 replies
  • 84 views

Badge

Hello, 

I am carrying out a study in which I wish to make several people's speeches appear in writing. 
For example: Math: "I like apples".
My problem is that I would like "I like apples" to appear letter by letter on the screen and not all at once.

So I would like to create a typewriter effect.

Any help would be greatly appreciated! 

Thanks!

icon

Best answer by rondev 29 August 2020, 13:16

View original

4 replies

Userlevel 7
Badge +22

Use the code given here

Badge

Hello, 
Thank you very much for your response.
When you paste the code into the HTML part of the question, it also displays the "Click me" button.
I'm really bad in coding, so I don't know how to make the text appear automatically without the "Click me" button and without the word "Typewriter".
Do you know how to do that? 
Thanks again.

Userlevel 7
Badge +22

Paste the below code in the HTML view of the question

 
Paste the below code in the onReady function of the javascript:

function typeWriter() {
      if (i < txt.length) {
         document.getElementById("demo").innerHTML += txt.charAt(i);
         i++;
         setTimeout(typeWriter, speed);
      }
  }

var i = 0;
   
  var speed = 100;

var txt = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.";

typeWriter();
Check the demo here

Badge

https://www.qualtrics.com/community/discussion/comment/29726#Comment_29726Thank you very much !!

Leave a Reply