2.0.2 • Published 5 months ago

@vianetz/animated-headlines-vanilla v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Animated Headlines with Vanilla JavaScript

Animated headlines with interchangeable words that replace one another through CSS transitions.
See demo.

Installation

npm

npm install @vianetz/animated-headlines-vanilla

bower

bower install @vianetz/animated-headlines-vanilla

Default Usage

Include the css in your head.

<link rel="stylesheet" src="dist/animated-headline.css">

Use the following markup.

<section class="animated-headline">
    <h1>
        My favorite food is
        <span class="ah-words-wrapper">
            <b class="is-visible">pizza</b>
            <b>sushi</b>
            <b>steak</b>
        </span>
    </h1>
</section>

Finally, initialize the plugin.

<script src="dist/animated-headline.js"></script>
<script>
    document.addEventListener('DOMContentLoaded', () => AnimatedHeadline('.ah-words-wrapper'));
</script>

Advanced Usage

The plugin provides multiple options to customize the animation type and delay.

<script>
    document.addEventListener('DOMContentLoaded', () =>
        AnimatedHeadline('.ah-words-wrapper', {
            animationType: 'type',
            animationDelay: 1500,
        })
    );
</script>

Options

It is recommended to use the default delay options. Because of this, I won't list them below. See app.ts for a complete list of options.

License

Animated Headlines is open-sourced software licensed under the MIT license.

2.0.2

5 months ago

2.0.1

6 months ago

2.0.0

7 months ago