Skip to content

Instantly share code, notes, and snippets.

View byrichardpowell's full-sized avatar

Richard Powell byrichardpowell

View GitHub Profile
( function($, undefined) {
// Truncates a wrapper & provides a more link to show the content in full
$.fn.truncate = function( c ) {
return this.each( function() {
// Trucate, add class, add more link
var $wrapper = $(this).css( { 'height' : c.height, 'overflow' : 'hidden'} ).addClass('truncated').after('<span class="truncate-more">more</span>');