[Open-source] jquery. ellipsis truncates content based on the width (not the number of words) and supports multiple lines of content

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.