
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
A lightweight, easy-to-implement jQuery animated typing plugin that types text for you.
A lightweight jQuery plugin that outputs text like it's being typed. It allows you to type single strings, multiple strings that stack, multiple strings that delete & replace each other, and even HTML tags & entities. You can also loop strings or sets of strings continuously.
Checkout several demos and a sandbox where you can try it out at macarthur.me/typeit.
Get it from this repo, or from the following sources:
https://cdn.jsdelivr.net/jquery.typeit/3.0.0/typeit.min.js
on your page.npm install typeit
.<span class="type-it"></span>
<script src="jquery-2.1.4.min.js"></script>
<script src="typeit.js"></script>
You're ready to start typing!
You can modify the options for the plugin in two different ways -- either by inserting them directly into the function call, or by using data-* attributes.
strings: ['String #1','String #2']
). You can optionally place them in quotation marks, separated by <br>
tags, however.Example:
<span class="type-it"></span>
$('.type-it').typeIt({
strings: 'Enter your string here!',
speed: 300,
lifeLike: false,
cursor: true
});
data-typeit-strings='["string #1", "string #2"]'
Example:
<span class="type-it"
data-typeit-strings="A new string to type."
data-typeit-speed="100"
data-typeit-lifelike="true"
data-typeit-cursor="true">
</span>
$('.type-it').typeIt();
You can also define what to type a third way -- by simply filling the element with a string or strings of text. This is convenient because if a user doesn't have JavaScript enabled, they'll still be able to read the text, and the text will be available for SEO purposes. Note: by default, the plugin will use the string that's in the element. If strings are defined either in the function call or data- attributes, they will be overridden.*
<span class="type-it">This is the string that will be typed.</span>
Aside from simply typing a single string, you can configure TypeIt to type multiple strings. If you define your strings within your HTML element, just separate them with <br>
tags:
<span class="type-it">Here is a string. <br>And here is another!</span>
If they're defined in the settings object, it's possible to put them inside quotation marks separated by <br>
tags, but it's recommended that you use an array:
$('.type-it').typeIt({
strings: ['Enter your string here!', 'Another string!']
});
By default, multiple strings will stack on top of each other (breakLines = true). However, you can also set them to delete and replace each other:
$('.type-it').typeIt({
strings: ['Enter your string here!', 'Another string!'],
breakLines: false
});
TypeIt will handle HTML tags in your strings, as long as they're only one level deep:
// GOOD! :)
$('.typeit-box').typeIt({
strings: '<h1 class="your-class">This is a string!</h1>',
}
// BAD! :(
$('.typeit-box').typeIt({
strings: '<h1 class="your-class"><span>This is a string!</span></h1>',
}
And it'll also handle HTML entities:
$('.typeit-box').typeIt({
strings: '<h1 class="your-class">One thing & another!<h1>',
}
To disable all HTML rendering, set 'html' to false.
TypeIt allows you to use a custom callback function when you've completed typing. To use one, simply add it as the second argument when it's initialized. Note: if you've enabled loop
, this is useless.
$('.typeit-box').typeIt({
strings: 'Here is a string!',
}, function() {
console.log('This is your callback function!');
});
There are a number of options you may use to customize typeIt.
Option | Description | Default Value |
---|---|---|
strings | The string(s) to be typed. | 'Your default string.' |
speed | The typing speed. | 100 |
lifeLike | Will make the typing pace irregular, as if a real person is doing it. | true |
cursor | Show a blinking cursor at the end of the string(s). | true |
cursorSpeed | The blinking speed of the cursor. | 1000 |
breakLines | Choose whether you want multiple strings to be printed on top of each other (breakLines = true), or if you want each string to be deleted and replaced by the next one (breakLines = false). | true |
breakDelay | The amount of time between typing multiple strings. | 750 |
startDelay | The amount of time before the plugin begins typing after initalizing. | 250 |
loop | Have your string or strings continuously loop after completing. | false |
loopDelay | The amount of time between looping over a string or set of strings again. | 750 |
html | Handle strings as HTML, which will process tags and HTML entities. If 'false,' strings will be typed literally. | true |
Let me know! Otherwise, play with it yourself. Gulp is configured to check & minify the JavaScript. In the root of the repo, use these commands to run these default tasks and watch for file changes (make sure Node.js, npm, and Gulp are installed on your computer):
npm install
gulp
If I've made your life eaiser in some way by creating this thing and want to kick a small "thank you" my way, I'd very much appreciate it!
PayPal: paypal.me/alexmacarthur
Venmo: venmo.com/amacarthur
FAQs
The most versatile animated typing utility on the planet.
The npm package typeit receives a total of 5,994 weekly downloads. As such, typeit popularity was classified as popular.
We found that typeit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.