A jquery plugin for CSS3 text animations.

Overview

Textillate.js v0.4.1 JS.ORG

See a live demo here.

Textillate.js combines some awesome libraries to provide an easy-to-use plugin for applying CSS3 animations to any text.

Usage

Let's start with the basic markup:

<h1 class="tlt">My Title</h1>

And your JavaScript should look like this:

$(function () {
	$('.tlt').textillate();
})

This will animate using the default options. To change the defaults, you can either use the html data api:

<h1 class="tlt" data-in-effect="rollIn">Title</h1>

or pass in options on initialization (see full list of options below):

$('.tlt').textillate({ in: { effect: 'rollIn' } });

You can also tell textillate.js to animate a list with the following markup:

<h1 class="tlt">
	<ul class="texts">
		<li data-out-effect="fadeOut" data-out-shuffle="true">Some Title</li>
		<li data-in-effect="fadeIn">Another Title</li>
	</ul>
</h1>
$('.tlt').textillate();

Notice that you can control the animation parameters on each text (<li>) using the data api.

Dependencies

To start using textillate.js, you will need the following:

Options

$('.tlt').textillate({
  // the default selector to use when detecting multiple texts to animate
  selector: '.texts',

  // enable looping
  loop: false,

  // sets the minimum display time for each text before it is replaced
  minDisplayTime: 2000,

  // sets the initial delay before starting the animation
  // (note that depending on the in effect you may need to manually apply
  // visibility: hidden to the element before running this plugin)
  initialDelay: 0,

  // set whether or not to automatically start animating
  autoStart: true,

  // custom set of 'in' effects. This effects whether or not the
  // character is shown/hidden before or after an animation
  inEffects: [],

  // custom set of 'out' effects
  outEffects: [ 'hinge' ],

  // in animation settings
  in: {
  	// set the effect name
    effect: 'fadeInLeftBig',

    // set the delay factor applied to each consecutive character
    delayScale: 1.5,

    // set the delay between each character
    delay: 50,

    // set to true to animate all the characters at the same time
    sync: false,

    // randomize the character sequence
    // (note that shuffle doesn't make sense with sync = true)
    shuffle: false,

    // reverse the character sequence
    // (note that reverse doesn't make sense with sync = true)
    reverse: false,

    // callback that executes once the animation has finished
    callback: function () {}
  },

  // out animation settings.
  out: {
    effect: 'hinge',
    delayScale: 1.5,
    delay: 50,
    sync: false,
    shuffle: false,
    reverse: false,
    callback: function () {}
  },

  // callback that executes once textillate has finished
  callback: function () {},

  // set the type of token to animate (available types: 'char' and 'word')
  type: 'char'
});

Events

Textillate triggers the following events:

  • start.tlt - triggered when textillate starts
  • inAnimationBegin.tlt - triggered when the in animation begins
  • inAnimationEnd.tlt - triggered when the in animation ends
  • outAnimationBegin.tlt - triggered when the out animation begins
  • outAnimationEnd.tlt - triggered when the out animation ends
  • end.tlt - triggered when textillate ends
$('.tlt').on('inAnimationBegin.tlt', function () {
  // do something
});

Methods

  • $element.textillate('start') - Manually start/restart textillate
  • $element.textillate('stop') - Manually pause/stop textillate
  • $element.textillate('in') - Trigger the current text's in animation
  • $element.textillate('out') - Trigger the current text's out animation

Code Samples

Comments
  • Certain

    Certain "In" animations dont fade in when used as the initial effect.

    Certain "In" animations seem to not "fade in" correctly when used as the first effect:

    flash,bounce,shake,tada,swing,wobble, pulse are some examples.

    The effect still works, but only after the full text kindof "slams" in all at once. If however I use an effect like "fadeInBigLeft" first, all subsequent effects work properly. The easiest way I've found to show this behavior is to edit the example playground (index.html) and change the line:

    $form.find('[data-key="effect"][data-type="in"]').val('fadeInLeftBig');
    

    to $form.find('[data-key="effect"][data-type="in"]').val('flash');

    I think this only changes the initial "In" Effect.

    Basically I'm seeing the same issue in a HTML i'm doing where i just want to use the "flash" effect on some text but want it to fade in nicely from left to right

    If i'm doing something wrong please let me know. Otherwise I'd even settle for a workaround.

    Thanks.

    opened by quizjax 18
  • ::before attribute not working?

    ::before attribute not working?

    I'd like to incorporate a social media icons before every li element:

    li id="twitter" data-in-effect="fadeIn" data-out-effect="fadeOut" li id="facebook" data-in-effect="fadeIn" data-out-effect="fadeOut" li id="youtube" data-in-effect="fadeIn" data-out-effect="fadeOut"

    I'm using:

    li#twitter::before {content: url(../assets/social/facebook.svg);} li#facebook::before {content: url(../assets/social/facebook.svg);} li#youtube::before {content: url(../assets/social/youtube.svg);}

    But it seems like this plugin is overriding any extra elements? Very confused...

    opened by FlatlineTV 11
  • Not working with Ajax ?

    Not working with Ajax ?

    hi,

    the Textillate is fantastic, but seems like not working when i tried to make it work with ajax, ,,im very new to web development, need your advice.. thank you!

    code is like this:

    $(document).ready(function(){

    $("button").on("click",function(){

    $("#p1").load("ajax/demo_test.txt");
    
    $('.tlt').textillate('in');
    

    }); });

    opened by maverickhy 5
  • XSS attacks

    XSS attacks

    I am sanitizing text before inserting it to the dom then running textillate on that DOM element. The problem is that textillate takes the content and then creates dom elements out of it (line 98, line 105, line 132) thus causing XSS attacks. Try it with <script>alert('test')</script>

    opened by ghost 5
  • Each word is cut off at the beginning and end on safari

    Each word is cut off at the beginning and end on safari

    Hi Jordan.

    Great plugin. I have time using some plugin projects. In this case I have a drawback specifically in Safari. This only happens with a particular typeface. Guld Script W01 Regular

    I think it has to do with translate3d. I tried to put a padding for each span in the animation but I did not manage to find the solution. If you have experienced a similar case or have an idea how can I solve it, I will be very grateful.

    Attached the images of the case.

    case1 case2

    Thanks

    opened by minonario 4
  • Not working with JS array of strings

    Not working with JS array of strings

    So I'm trying to build a random quote generator and right now I've got an array;

    var quotes = ["this is quote one", "quote two"]
    

    and then I've got some code that calculates a random number and I end up with

    quoteDiv.innerHTML = quotes[quotePosition];
    

    and in my HTML I've got

    <div id="quoteDiv"></div>
    

    and everything works fine but no matter where I add the .tlt class to for textillate, I can't seem to get it to animate the text, it just shows the text without animating it.

    My apologies for not being very clear with what I'm working with, but any help would be appreciated.

    enhancement 
    opened by Snazzyham 4
  • change text dynamically

    change text dynamically

    This is one of the coolest jquery plugin, but with one flaw . why can't text be changed dynamically , i spentb 2 hrs trying to implement this plugin in angular , i wanted the text to be two way bound , but i couldn't succeed as i couldn't change text once plugin is initialized , i am missing something

    pls help thanks

    opened by programming-kid 4
  • Can't restart a previously Textillated object ?

    Can't restart a previously Textillated object ?

    If i run .textillate on an object for the fist time, all seems fine. Nice Work! But what's bugging me is that the second time I run this on the same object, it hase a wrong behavior. Or is there an otehr wa to restart the animation ?

    opened by wautersj 4
  • [enhancement] Add missing bower.json.

    [enhancement] Add missing bower.json.

    Hey, maintainer(s) of jschr/textillate!

    We at VersionEye are working hard to keep up the quality of the bower's registry.

    We just finished our initial analysis of the quality of the Bower.io registry:

    7530 - registered packages, 224 of them doesnt exists anymore;

    We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

    Sadly, your library jschr/textillate is one of them.

    Can you spare 15 minutes to help us to make Bower better?

    Just add a new file bower.json and change attributes.

    {
      "name": "jschr/textillate",
      "version": "1.0.0",
      "main": "path/to/main.css",
      "description": "please add it",
      "license": "Eclipse",
      "ignore": [
        ".jshintrc",
        "**/*.txt"
      ],
      "dependencies": {
        "<dependency_name>": "<semantic_version>",
        "<dependency_name>": "<Local_folder>",
        "<dependency_name>": "<package>"
      },
      "devDependencies": {
        "<test-framework-name>": "<version>"
      }
    }
    
    

    Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

    NB! Please validate your bower.json with jsonlint before commiting your updates.

    Thank you!

    Timo, twitter: @versioneye email: [email protected] VersionEye - no more legacy software!

    opened by timgluz 4
  • The animation is only executed once

    The animation is only executed once

    Hi, I'm having an issue : I want to bind to an element with id #btn the following function

    jQuery('#btn').click(function() {
            jQuery('.tlt').textillate({ 
                inEffects: ['shake'],   
                outEffects: ['shake'], 
                loop: false,  
                autoStart: true, 
                initialDelay: 500 , 
                in: {    
                    effect: 'shake',
                    sync: true,    
                    shuffle: false
                } ,
                out: {    
                    effect: 'shake',
                    sync: true,    
                    shuffle: false
                } 
                });
    }); 
    

    The animation work and the text shakes the first time. Pressing the button a second time doesn't animate anything.

    Any suggestion? Am I doing something wrong here?

    opened by adv0r 4
  • Duration Option

    Duration Option

    I've added an option where you require a fixed duration for the animation. Let's say 1 second. So it calculates the speed of the animation based on the number of animated characters to make sure each transition takes the same length of time.

    There is also a bug fix where HTML was finding its way into it. It now uses .text instead of .html where relevant.

    I'm about to fork this code quite dramatically - so I thought I'd commit this before I make it completely unusable!

    opened by andrewspode 3
  • animate.css for 4.1.1

    animate.css for 4.1.1

    Replace the original animate.css with the animate.compat.css in animate.css v4.1.1

    Animate.css v4 brought some improvements, improved animations, and new animations, which makes it worth upgrading. But it also comes with a breaking change: we have added prefix for all of the Animate.css classes - defaulting to animate__ - so a direct migration is not possible.

    But fear not! Although the default build, animate.min.css, brings the animate__ prefix we also provide the animate.compat.css file which brings no prefix at all, like the previous versions (3.x and under).

    opened by queuecat 0
  • text changing on centered sentence

    text changing on centered sentence

    Hi,

    I have trouble using textillate on centered H1. i change between few different size's words and every time a new word appear, the sentence auto center again. I would prefer that the other part of the sentence don't move , just the words appear and disappear.

    Maybe it's more understanable visitng the website, check the H1 https://www.donna.io/

    Thanks so much if you provide me a solution.

    opened by PaulPoul 0
  • InitialDelay Option not working

    InitialDelay Option not working

    I am using Uikit modal with JQuery Textillate.js. The goal is animate the texts in the modal when it opens and repeat the animation when modal is closed and opened again. I was able to get it to work. But I found that the initialdelay option for Textillate is not working so all animated texts appear at the same time.

    How can I get the initialDelay: 1000 to work so that the second animated text would be delayed for a while. It works fine when if I am not using Textillate methods - $element.textillate('in') and $element.textillate('out')

    I have created an codepen for it here - https://codepen.io/ajaxthemestudios/pen/XWJRBbW

    opened by ajaxthemestudios 0
  • Textillate @types for typescript

    Textillate @types for typescript

    Hi, i've seen that textillate is an excellent library to implement in modern projects, with an small size too. But is there a @type file for implementing it with typescript? Or do we need to create a new one? Thanks.

    opened by geanfrancovolpe 0
  • Activating Open Collective

    Activating Open Collective

    Hi, I'm making updates for Open Collective. Either you or a supporter signed this repo up for Open Collective. This pull request adds backers and sponsors from your Open Collective https://opencollective.com/textillate ❤️

    It adds two badges at the top to show the latest number of backers and sponsors. It also adds placeholders so that the avatar/logo of new backers/sponsors can automatically be shown without having to update your README.md. [more info]. See how it looks on this repo. We have also added a postinstall script to let people know after npm|yarn install that you are welcoming donations (optional). [More info] You can also add a "Donate" button to your website and automatically show your backers and sponsors there with our widgets. Have a look here: https://opencollective.com/widgets

    P.S: As with any pull request, feel free to comment or suggest changes. The only thing "required" are the placeholders on the README because we believe it's important to acknowledge the people in your community that are contributing (financially or with code!).

    Thank you for your great contribution to the open source community. You are awesome! 🙌 And welcome to the open collective community! 😊

    Come chat with us in the #opensource channel on https://slack.opencollective.com - great place to ask questions and share best practices with other open source sustainers!

    opened by monkeywithacupcake 0
Releases(0.4.0)
Owner
Jordan Schroter
Jordan Schroter
Super-smooth CSS3 transformations and transitions for jQuery

jQuery Transit Super-smooth CSS3 transformations and transitions for jQuery jQuery Transit is a plugin for to help you do CSS transformations and tran

Rico Sta. Cruz 7.4k Dec 23, 2022
Matteo Bruni 4.7k Jan 4, 2023
CSS3 backed JavaScript animation framework

Move.js CSS3 JavaScript animation framework. About Move.js is a small JavaScript library making CSS3 backed animation extremely simple and elegant. Be

Sloth 4.7k Dec 30, 2022
It's a presentation framework based on the power of CSS3 transforms and transitions in modern browsers and inspired by the idea behind prezi.com.

impress.js It's a presentation framework based on the power of CSS3 transforms and transitions in modern browsers and inspired by the idea behind prez

impress.js 37k Jan 2, 2023
🍿 A cross-browser library of CSS animations. As easy to use as an easy thing.

Animate.css If you need the old docs - v3.x.x and under - you can find it here. Just-add-water CSS animation Installation Install with npm: npm instal

Animate.css 76.7k Dec 30, 2022
Javascript library to create physics-based animations

Dynamics.js Dynamics.js is a JavaScript library to create physics-based animations To see some demos, check out dynamicsjs.com. Usage Download: GitHub

Michael Villar 7.5k Jan 6, 2023
🍿 A cross-browser library of CSS animations. As easy to use as an easy thing.

Animate.css If you need the old docs - v3.x.x and under - you can find it here. Just-add-water CSS animation Installation Install with npm: npm instal

Animate.css 76.7k Jan 4, 2023
Animation Academy teaches you CSS animations using the transition and animation properties.

Animation Academy Open Animation Academy > Contents Background Built With Functionality Feature Highlights Wireframes Features In Development Backgrou

Jacob Benowitz 6 Jun 23, 2022
Nebula is a lightweight (1kb compressed) JavaScript library that creates beautiful universe animations.

Nebula is a lightweight JavaScript library for creating beautiful universe animations. Including configurable Stars, Nebulas, Comets, Planets and Suns. Compatible with SSR

Florian DE LA COMBLE 34 Nov 25, 2022
A simple and easy jQuery plugin for CSS animated page transitions.

Animsition A simple and easy jQuery plugin for CSS animated page transitions. Demo & Installation http://git.blivesta.com/animsition/ Development Inst

Yasuyuki Enomoto 3.8k Dec 17, 2022
fakeLoader.js is a lightweight jQuery plugin that helps you create an animated spinner with a fullscreen loading mask to simulate the page preloading effect.

What is fakeLoader.js fakeLoader.js is a lightweight jQuery plugin that helps you create an animated spinner with a fullscreen loading mask to simulat

João Pereira 721 Dec 6, 2022
A jQuery plugin that recreates the Material Design pre-loader (as seen on inbox).

Material Design Preloader!s A jQuery plugin that recreates the Material Design preloader (as seen on inbox). I was fascinated when I first saw the pre

Aaron Lumsden 376 Dec 29, 2022
Simple parallax scrolling effect inspired by Spotify.com implemented as a jQuery plugin

Parallax.js Simple parallax scrolling implemented as a jQuery plugin. http://pixelcog.com/parallax.js/ Please also check our v2.0.0-alpha! We'd be hap

PixelCog Inc. 3.5k Dec 21, 2022
A jQuery plugin that assists scrolling and snaps to sections.

jQuery Scrollify A jQuery plugin that assists scrolling and snaps to sections. Touch optimised. Demo http://projects.lukehaas.me/scrollify. More examp

Luke Haas 1.8k Dec 29, 2022
Lightweight, simple to use jQuery plugin to animate SVG paths

jQuery DrawSVG This plugin uses the jQuery built-in animation engine to transition the stroke on every <path> inside the selected <svg> element, using

Leonardo Santos 762 Dec 20, 2022
Unobtrusive page transitions with jQuery.

smoothState.js smoothState.js is a jQuery plugin that progressively enhances page loads to give us control over page transitions. If the user's browse

Miguel Pérez 4.5k Dec 21, 2022
Slide-element - A ~700 byte Promise-based library for animating elements with dynamic heights open & closed. Basically, a modern variant of jQuery's slideUp(), slideDown(), and slideToggle().

slide-element A tiny, accessible, Promise-based, jQuery-reminiscent library for sliding elements with dynamic heights open & closed. To see it in acti

Alex MacArthur 165 Dec 12, 2022
fullPage plugin by Alvaro Trigo. Create full screen pages fast and simple

fullPage.js English | Español | Français | Pусский | 中文 | 한국어 Available for Vue, React and Angular. | 7Kb gziped | Created by @imac2 Demo online | Cod

Álvaro 34.3k Dec 30, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022