1.0.1 • Published 5 years ago

jquery-textfader v1.0.1

Weekly downloads
2
License
MIT
Repository
-
Last release
5 years ago

JQuery TextFader

jQuery TextFader is a jQuery plugin designed to create simple text faders.

How to use

Make sure to include JQuery in your page:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

Include JQuery TextFader:

<script src="path/to/js/textfader.js"></script>

Or install via npm:

npm install jquery-textfader

Usage

Initialize a textfader:

var textFader = new TextFader();

textFader.init({
   selector: '#fader',
   content: ['String 1', 'Another string', 'A third string']
});

If you don't provide a selector, TextFader will search for all elements with the .textfader class.

Options

OptionDescriptionExample
SelectorProvide a class or ID of the element in which the textfader should appear. Remember to add a # in front of an ID and a . in front of a class.selector: '#faderID'
ContentArray of strings the textfader should display.content: ['String 1', 'Another string', 'A third string']
DelayHow much time between two strings in milliseconds.delay: 5000
FadeSet a fade duration in milliseconds. Use fade: 0 for no fade at all.fade: 500
LoopSet the fader to loop when it's done and start from the beginning.loop: false

Methods

MethodDescription
InitInitializes the fader.
RestartRestarts the fader from the beginning. It's prossible to define the string the fader should restart at using: fader.restart({startAt: 1}). Leaving this empty will restart the fader at the first string.

License

MIT