Typing effect using HTML,CSS JS
Hello everyone, welcome to mradvancetechnical, today we are going to learn about typing effect using HTML,CSS,JS
we will be using simple way to implement this.
Where to use Typing effect.
if you are making a portfolio site OR want to add some feature on your existing site then you can use this.
so without wasting the time let's get started here is a code to implement such effect.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>typing effect in js</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<h1 class="genrate"><b></b> </h1> | |
</body> | |
<script src="script.js"></script> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let a="Welcome"; | |
let v=0; | |
var uniqueid=setInterval(create,230); | |
// setInterval() will call create() after every 230ms. | |
function create(){ | |
var grettings=document.getElementsByClassName("genrate"); | |
//check if counter variable V and string length is same then clearInterval() | |
if(a.length==v) | |
clearInterval(uniqueid); | |
else{ | |
//appending character | |
grettings[0].append(a[v]); | |
v++; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.genrate{ | |
text-align: center; | |
font-size: 10em; | |
color: white; | |
font-family: 'Segoe UI'; | |
} | |
body{ | |
background-color: black; | |
} |
No comments: