-
-
Save melanyss/3b144a6df14bce11d4f6745b1c76a002 to your computer and use it in GitHub Desktop.
Create a typing effect in 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
<html> | |
<head> | |
<title>Type writing</title> | |
<style> | |
.btn{ | |
border: none; | |
background-color: #048bff; | |
width: 90px; | |
height: 40px; | |
font-family: cursive; | |
} | |
</style> | |
</head> | |
<body> | |
<button class="btn" onclick="typewriter()">Click me</button> | |
<p id="demo"></p> | |
<script type="text/javascript"> | |
var i = 0; | |
var txt = 'Hey these is gokul welcome to techy tech in these video i am gonna show you how to create a typing effect in html & js'; | |
var speed= 60; | |
function typewriter() | |
{ | |
if(i<txt.length) | |
{ | |
document.getElementById("demo").innerHTML += txt.charAt(i); | |
i++; | |
setTimeout(typewriter , speed); | |
} | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment