jQuery Plugin For Preventing Orphans In Text - Unorphanize

jQuery Plugin For Preventing Orphans In Text - Unorphanize
File Size: 10.7 KB
Views Total: 452
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Just another jQuery Typography plugin that prevents Orphans and allows to specify how many words allowed to display in the last line of a paragraph.

How to use it:

1. Put the jQuery Unorphanize plugin's script after jQuery library like this:

<script src="//code.jquery.com/jquery-3.1.1.slim.min.js"></script>
<script src="unorphanize.jquery.js"></script>

2. Call the function unorphanize() on the target paragraph and done.

$(".demo").unorphanize();

3. Specify how many words to be displayed in the last line of the paragraph.

$(".demo").unorphanize({
  words: 3
});

4. You can also style the words in the last line with the following options.

$(".demo").unorphanize({
  wrapEl: 'span',
  className: 'your-css-name',
});

This awesome jQuery plugin is developed by tedw. For more Advanced Usages, please check the demo page or visit the official website.