Jquery. ellipsis
The width (not the number of words) of the content is automatically calculated, and the ellipsis is added. The content is not restricted by Chinese and English characters or symbols.
If the width of different characters is different, for example, L and W, especially in Chinese and English, the final content width varies greatly.
Jquery. ellipsis. js depends on jquery. Usage
$ (DOM). ellipsis ({maxwidth: 120, maxline: 2 });
Maxwidth, max width maxline, max brightness, title, and so on usually need to support multi-line content display. The default value is 1.
Jquery. ellipsis. unobtrusive. js depends on jquery. ellipsis. JS, which is optional and is used to control behavior usage using data-tags:
<P Data-ellipsis = "true" data-ellipsis-max-width = "200" data-ellipsis-max-line = "2">... </P>
This JS can be automatically processed based on the data attribute on the element without additional scripts.
Source code and demo download: https://github.com/thinhunan/jquery.ellipsis