Typing Effect with typed.js

Jatin Sharma - Dec 9 '21 - - Dev Community

As you may have already seen some website which has some kind of typing animation. It looks cool right but what if I tell you it is very easy to do.

I have already made an article about how you can make this type of effect with CSS but today we will build something different than that. In this effect, you can give multiple strings and it will display one by one.

First of all, let's visualize what I am talking about -

Preview

preview

To make this work we need to use a library called typed.js So firstly add the following script to your project.

<script src="https://cdn.jsdelivr.net/npm/typed.js@2.0.12"></script>
Enter fullscreen mode Exit fullscreen mode

Now let's look at the rest of code, how this is cooking.

HTML

<h1>Hi, I am <span class="title"></span></h1>
Enter fullscreen mode Exit fullscreen mode

HTML is very simple we just need to use only one element in order to make this work.

JS

var options = {
  strings: ["Jatin Sharma", "React Developer", "Python Developer"],
  typeSpeed: 40,
  backSpeed: 40,
  loop: true
};

var typed = new Typed(".title", options);
Enter fullscreen mode Exit fullscreen mode

codepen

Conclusion

It is as simple as that, now you can use this in your projects wherever you want. To learn how you can make typing effect in CSS visit the given link.

You can now extend your support by buying me a Coffee.😊👇
buymecoffee

Also Read

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .