jQuery-avoidOrphans demo page

This is a demo of the avoid-orphans jQuery plugin.

The repo can be found at: https://github.com/abcnews/jquery-avoidOrphans.

Example 1

I am a sentence that will leave one word as an orphan by default.

I am not one to be outdone. I too by default will beget an orphan.

To avoid orphans, just call the avoidOrphans jQuery method on the paragraphs.

$('#example1 p').avoidOrphans();

Apply avoidOrphans by clicking this button if you like:

Example 2

I am a sentence that will leave one word as an orphan by default.

I am not one to be outdone. I too by default will beget an orphan.

Note that if you apply avoidOrphans to the container, it will only apply to the last element in the container.

$('#example2').avoidOrphans();

Try it out so that you can see what we mean: