Package Exports
- truncated.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (truncated.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
🚨 This currently an untested project. Updates will be coming 9/11/16. 🙌
Truncated.js
Truncated.js is a javascript plugin that shortens text strings based on a specified max-height & adds an ellipsis at the end.
Setup
npm install truncated.js --save-devbower install truncated.js --save-devRun
- Include truncated.js into your
vendorfile or in a<script>tag. - Add truncated
css/scssto yourcss. truncatethe element you'd like to give truncation to.
truncated('selector', num);🔥Basic Examples
Basic
// plain js version
truncated('selector', num);
// jquery version
$('selector').truncated(num);Or Multiples
// plain js version
truncated('selector', num);
// jquery version
$('selector').truncated(num);But not this one
truncated('selector:not([not this selector])', num);
// jquery version
$('selector:not([not this selector])').truncated(num);How?
Trucated.js trims a text string to a last full word of what can fit within a specified max height.
Why?
Truncated.js is done because of a need for simpicity when it comes to text truncation. Several plugins that I've reviewed oversolve the issue for what people want when they want text truncation - for text to look nice in a specified space.
This plugin is small - ~1kb unminified & is meant to do 1 thing - truncate text based on a specified max height.