Typing & erasing effects, plus a blinking cursor

Developer
Size
2,362 Kb
Views
54,648

How do I make an typing & erasing effects, plus a blinking cursor?

Demo of typing & erasing effects, plus a blinking cursor (full-text tutorial).. What is a typing & erasing effects, plus a blinking cursor? How do you make a typing & erasing effects, plus a blinking cursor? This script and codes were developed by Stathis on 31 July 2022, Sunday.

Typing & erasing effects, plus a blinking cursor Previews

Typing & erasing effects, plus a blinking cursor - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Typing & erasing effects, plus a blinking cursor</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <p> <input type="text" id="user-caption" value="Type something here!" /> <input type="button" id="test-typing" value="Test Typing Effect" /> <input type="button" id="test-erasing" value="Test Erasing Effect" />
</p>
<p class="console"> <span>C:\</span><span id="caption"></span><span id="cursor">|</span>
</p> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Typing & erasing effects, plus a blinking cursor - Script Codes CSS Codes

body
{ background-color: #000; padding: 1%; color: #ccc; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1em;
}
.console
{ font-family: "Lucida Sans Typewriter", "Lucida Console", Monaco, "Bitstream Vera Sans Mono", monospace;
}
input[type="button"]
{ cursor: pointer;
}

Typing & erasing effects, plus a blinking cursor - Script Codes JS Codes

var captionLength = 0;
var caption = '';
$(document).ready(function() { setInterval ('cursorAnimation()', 600); captionEl = $('#caption'); $('#test-typing').click(function(){ testTypingEffect(); }); $('#test-erasing').click(function(){ testErasingEffect(); });
});
function testTypingEffect() { caption = $('input#user-caption').val(); type();
}
function type() { captionEl.html(caption.substr(0, captionLength++)); if(captionLength < caption.length+1) { setTimeout('type()', 50); } else { captionLength = 0; caption = ''; }
}
function testErasingEffect() { caption = captionEl.html(); captionLength = caption.length; if (captionLength>0) { erase(); } else { $('#caption').html("You didn't write anything to erase, but that's ok!"); setTimeout('testErasingEffect()', 1000); }
}
function erase() { captionEl.html(caption.substr(0, captionLength--)); if(captionLength >= 0) { setTimeout('erase()', 50); } else { captionLength = 0; caption = ''; }
}
function cursorAnimation() { $('#cursor').animate({ opacity: 0 }, 'fast', 'swing').animate({ opacity: 1 }, 'fast', 'swing');
}
Typing & erasing effects, plus a blinking cursor - Script Codes
Typing & erasing effects, plus a blinking cursor - Script Codes
Home Page Home
Developer Stathis
Username stathisg
Uploaded July 31, 2022
Rating 4.5
Size 2,362 Kb
Views 54,648
Do you need developer help for Typing & erasing effects, plus a blinking cursor?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Stathis (stathisg) Script Codes
Create amazing SEO content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!