Skip to content

ryhan/adopt.coffee

 
 

Repository files navigation

Adopt

If you seek consistent typography across all screen sizes, Adopt.coffee is for you. It's a simple jQuery plugin that removes orphans from your elements.

Usage

Include the jQuery library (version 1.8 or newer) and the adopt.min.js plugin file, *preferably at the bottom of the page before the closing </body> tag.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="jquery.adopt.min.js"></script>
<script>
  // To remove orphans from all headings.
  $('h1, h2, h3, h4, h5, h6').adopt();

  // To remove orphans from all article paragraphs.
  $("article p").adopt();
</script>

How it works

Adopt.coffee keeps orphans from forming by placing a &nbsp; HTML entity between the last two characters. This keeps them together when the window resizes, ensuring no word is ever alone.

About

jQuery plugin to remove orphans from your type.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CoffeeScript 100.0%