jQuery 缩短文本插件:Shorten

jopen 9年前

Shorten 是一个可以在 DIV 中自动缩短文本并且加上“show more”链接的 jQuery 插件。

Shortens the text within 'element' and add a 'more' link.

$(element).shorten();

Add a link with text 'read more' while shortening the content of element.

$(element).shorten({      moreText: 'read more'  });

Change the link text to 'read more' and 'read less' overriding default value 'more' and 'less'.

$(element).shorten({      moreText: 'read more',      lessText: 'read less'  });

Override default display 100 characters and hide text above 50 characters.

$(element).shorten({      showChars: '50',  });

jQuery 缩短文本插件:Shorten

项目主页:http://www.open-open.com/lib/view/home/1436525348020