A lightweight jQuery plugin to add a gradual typewriter 'letter-by-letter' reveal that is great for adding emphasis to a header or content.
View on GitHub View Demo PageDownload jquery.typewriter.js and included sound file. Put them into your project's root directory.
Paste the sound file and appropriate jQuery files into your HTML before the closing body tag as seen below.
<audio class="sound" src="typewriter.wav"></audio>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="js/jquery.typewriter.js"></script>
Add the following code to your CSS file
.typeAction {
visibility:hidden;
}
span {
padding-left:2px;
animation: blink 700ms steps(1) infinite: ;
-webkit-animation: blink 700ms steps(1) infinite;
}
@keyframes blink { 50% { color: transparent; } }
@-webkit-keyframes blink { 50% { color: transparent; } }
}
Paste the following code inside your primary JavaScript file to input and start the effect.
Note: Replace the 'h1' with the text element you'd like to focus the effect on.
$(function() {
$('h1').typewriter({
});
});
sound (default:false) : Setting to true turns on the typewriter sound effect.
cursorVisible (default:true) : Adjusting to false makes the blinking cursor disappear.
cursorColor : will be a shade of grey unless otherwise set.
randomTypeSpeed (default:true) : setting to false will make the typing speed rhythmic.
$(function() {
$('h1').typewriter({
sound:true,
cursorVisible:false,
cursorColor:"#551A8B",
randomTypeSpeed:false,
});
});
Made by Allison Tarr