Skip to content

Javascript text splitter for easy seo friendly animations, permit text, word, spaces and special characters animation.

Notifications You must be signed in to change notification settings

jcwalker3/split-text-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SplitTextJS

NPM package

Light weight Javascript text splitter

This Javascript text splitter has been created to allow easy and seo friendly text splitting (for animations) in two lines of code, it's including words, letters, spaces and special characters splitting.

ExampleRepositoryQuestions

Usage

Download the file and include it in your HTML

<p class="text">This is my cool text!</p>

<script src="js/SplitTextJS.js"></script>

Or install and import it as a module

$ npm install split-text-js

First, import SplitTextJS :

import SplitTextJS from 'split-text-js';

Then, use SplitTextJS :

<p class="text">This is my cool text!</p>
// Select the DOM element wich contains the target text
const text = document.querySelector('.text');

// Split the text and store the result
const splittedText = new SplitTextJS(text);

// Now you can access your splitted text in the returned object

// Acces words :
const textWords = splittedText.words;

// Acces letters :
const textChars = splittedText.chars;

// Acces spaces :
const textSpaces = splittedText.spaces;

// Acces original text :
const textOriginal = splittedText.originalText;

If everything went well you should see this.

Change log

Releases

About

Javascript text splitter for easy seo friendly animations, permit text, word, spaces and special characters animation.

Resources

Stars

Watchers

Forks

Packages

No packages published