Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A jQuery plugin to allow text elements on a page to be constrained by size.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 js
Octocat-spinner-32 CHANGELOG
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 index.html
Octocat-spinner-32 textconstrain-example.html
README.md

Text-constrain plugin for jQuery

A jQuery plugin to allow text elements on a page to be constrained by size (currently by words or by characters).

Demo

View the demo page.


Usage:

   $('.cmTextElement').cmtextconstrain({
           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: 'cmShowHide'}, // element shown to expose
           hideControl: {string: '[ - ]', title: 'Show Less', addclass: 'cmShowHide'}, // element shown to constrain
           trailingString: '...' // string to show at end of truncated text
           });

Methods:

   $('.cmTextElement').cmtextconstrain('destroy'); // destroy the instance of cmtextconstrain

License

jquery-locksize is licensed under the MIT License. The project is founded by CMGdigital.

Something went wrong with that request. Please try again.