Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the extra ellipsis in jquery

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to achieve excess ellipsis in jquery". In daily operation, I believe many people have doubts about how to achieve excess ellipsis in jquery. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubt of "how to achieve excess ellipsis in jquery". Next, please follow the editor to study!

Jquery implements the method of exceeding part of the ellipsis: 1, create a js sample file; 2, through the "$(" .ftlt _ lt_wzne ") .each (function () {...}" method to achieve qualified text and use ellipses when exceeding.

The operating environment of this tutorial: windows7 system, jquery3.2.1 version, Dell G3 computer.

How does jquery achieve the extra ellipsis?

Jquery qualifying text exceeds the ellipsis

We all know that one line can exceed the display ellipsis with css3, but it is troublesome to use css3 for multiple lines. Today, we use jquery to judge the number of words to limit the occurrence of ellipsis.

$(".ftlt _ lt_wzne") .each (function () {var maxwidth = 36 leading / how many characters if ($(this). Text (). Length > maxwidth) {$(this). Text ($(this). Text (). Substring (0, maxwidth)); $(this). Html ($(this). Html () +');}}) At this point, the study on "how to achieve the extra ellipsis in jquery" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report