Fork me on GitHub

jQuery.exdent

A small jQuery plugin to enable hanging punctuation, an advanced typographic feature. Elements are only exdented, if they are at the beginning of a line. The plugin changes the boring:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut a sapien. Aliquam aliquet purus molestie dolor.

to this mind-twisting, beautiful piece of modern web typography:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut a sapien. Aliquam aliquet purus molestie dolor.

You can customize the plugin to meet your exdentation needs:

// This exdents both <blockquote> and <q> by 0.5em
$('blockquote, q').exdent({
  by: '.5em'
});

// This exdents quotes by the width of german opening quotes
$('q').exdent({
  detect: '\u201E'
});

// or maybe you want to use jQuery's .css() syntax:
$('q').css('exdent', '9px');

The JavaScript file (minified) is 0.8 kB small and sends wire-glowing 532 bytes to the client if gzipped.

See the demo yourself. Issues are tracked on Github, and the project is hosted on Github, too.


Options:

jQuery.exdent understands these option parameters:


License

This plugin is published under the same terms as jQuery itself, namely the GPL license and an MIT-style license. You can choose either.


Note: Don't confuse this with jQuery.extend. ;-)