Created
August 8, 2017 06:42
-
-
Save anonymous/92f5288fea36bf3e3eb76889cd79347f to your computer and use it in GitHub Desktop.
// source https://jsbin.com
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> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
input { | |
height: 30px; | |
width: 50%; | |
padding: 5px; | |
font-size: 20px; | |
} | |
</style> | |
</head> | |
<body> | |
<input id="test" value"" placeholder=""/> | |
<script id="jsbin-javascript"> | |
var placeholder = 'Awesome'; | |
var element = document.getElementById('test'); | |
function animate(element, speed, text, lenght, wait){ | |
setTimeout(function(){ | |
var placeholder = text.slice(0, lenght); | |
element.placeholder = (lenght % 2 === 0) ? placeholder : placeholder + "|"; | |
if (text.length > lenght){ | |
animate(element, speed, text, lenght + 1, wait); | |
return; | |
} | |
}, speed); | |
} | |
animate(element, 200, placeholder, 0, 10); | |
</script> | |
<script id="jsbin-source-css" type="text/css">input { | |
height: 30px; | |
width: 50%; | |
padding: 5px; | |
font-size: 20px; | |
}</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var placeholder = 'Awesome'; | |
var element = document.getElementById('test'); | |
function animate(element, speed, text, lenght, wait){ | |
setTimeout(function(){ | |
var placeholder = text.slice(0, lenght); | |
element.placeholder = (lenght % 2 === 0) ? placeholder : placeholder + "|"; | |
if (text.length > lenght){ | |
animate(element, speed, text, lenght + 1, wait); | |
return; | |
} | |
}, speed); | |
} | |
animate(element, 200, placeholder, 0, 10); | |
</script></body> | |
</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
input { | |
height: 30px; | |
width: 50%; | |
padding: 5px; | |
font-size: 20px; | |
} |
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
var placeholder = 'Awesome'; | |
var element = document.getElementById('test'); | |
function animate(element, speed, text, lenght, wait){ | |
setTimeout(function(){ | |
var placeholder = text.slice(0, lenght); | |
element.placeholder = (lenght % 2 === 0) ? placeholder : placeholder + "|"; | |
if (text.length > lenght){ | |
animate(element, speed, text, lenght + 1, wait); | |
return; | |
} | |
}, speed); | |
} | |
animate(element, 200, placeholder, 0, 10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment