Text-constrain plugin for jQuery

Use:

$('.text-element').textconstrain({
    event: 'click', // for future extensibility to allow other events
    onExpose: function(){}, // a function to be run once the element is exposed
    onConstrain: function(){}, // a function to be run once the element is constrained
    restrict: {type: 'words', limit: 6}, // type can be 'words' or 'chars'
    showControl: {string: '[ + ]', title: 'Show More', addclass: 'show-hide'}, // element shown to expose
    hideControl: {string: '[ - ]', title: 'Show Less', addclass: 'show-hide'}, // element shown to constrain
    trailingString: '...' // string to show at end of truncated text
});

Methods:

$('.text-element').textconstrain('destroy'); // destroy the instance of textconstrain

Shorter Than the Limit Header

No ID given. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nulla justo, condimentum dapibus vulputate ac, feugiat in magna. Morbi congue, lectus eu tincidunt gravida, velit sem rutrum dolor, id convallis mauris dui vitae orci. Integer ornare commodo vulputate. Vivamus eget dignissim arcu. Sed non odio ac massa faucibus malesuada. Donec orci ante, ullamcorper sed consequat sit amet, malesuada vitae orci. Proin ut sapien at quam tristique malesuada vitae quis nisl. Cras et nunc sapien, commodo imperdiet erat. Sed non quam quis massa ultricies faucibus sed nec tellus. Nullam pellentesque sodales egestas. Aenean accumsan volutpat lectus, eget tincidunt diam pellentesque a. Donec lacinia eleifend nibh non tempus.

Longer Than The Limit Header will be Constrained

Random-hyphen! This is the text to which we will be applying the constraint. It is a paragraph element. Sed non quam quis massa ultricies faucibus sed nec tellus. Nullam pellentesque sodales egestas. Aenean accumsan volutpat lectus, eget tincidunt diam pellentesque a. Donec lacinia eleifend nibh non tempus.