Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mgalgs/jquery-yallipsis
Yet Another Ellipsis Plugin for jQuery
https://github.com/mgalgs/jquery-yallipsis
Last synced: 5 days ago
JSON representation
Yet Another Ellipsis Plugin for jQuery
- Host: GitHub
- URL: https://github.com/mgalgs/jquery-yallipsis
- Owner: mgalgs
- Created: 2011-01-21T22:52:21.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2011-01-22T01:04:58.000Z (about 14 years ago)
- Last Synced: 2025-01-20T23:03:10.774Z (13 days ago)
- Homepage:
- Size: 89.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
What is Yallipsis?
==================
Yallipsis is **Yet Another Ellipsis Plugin** for jQuery. It is tiny and very simple to use. It turns text like this:
> Hi I love stuff and stuff and I really love to eat pizza and stuff yes.into this:
> Hi I love stuff and...or this:
> ...and stuff yes.or this:
> Hi I lov...stuff yes.or this:
> ...I really love...Usage
=====
First, include `jquery.yallipsis.js` in your html document:
Basic Usage
-----------
$(function() {
$(".short").yallipsis();
});Options
-------
- maxChars
- The maximum number of characters to allow before we ellipsify. Default:
50
- replaceText
- Text to insert to indicate ellipsification. Default:
'...'
- where
- Where to truncate. Possible values:
'front'
,'back'
,'sides'
,'middle'
. Default:'back'
##### Examples #####
If we had a div in our document like so:
This is my really long sentence.
Then this:
$(function() {
$(".short").yallipsis({maxChars:7, replaceText:'***'});
});
would result in this:
This is***
and this:
$(function() {
$(".short").yallipsis({maxChars:10, where: 'sides'});
});
would result in this:
...really long...
Tips
----
If the `title` attribute of the element being ellipsified is empty,
the original text will get put there. So, you can combine yallipsis
with [tipTip] [1] (or any other jQuery quicktip plugin):
$(function() {
$(".short").yallipsis({maxChars:25}).tipTip({maxWidth:'auto'});
});
[1]: http://code.drewwilson.com/entry/tiptip-jquery-plugin "tipTip jQuery Plugin"