jquery控制超出2行写省略号
2016-12-15 11:37
387 查看
</style> <script type="text/javascript"> $(function () { $(".figcaption").each(function (i) { var divH = $(this).height(); var $p = $("p", $(this)).eq(0); while ($p.outerHeight() > divH) { $p.text($p.text().replace(/(\s)*([a-zA-Z0-9]+|\W)(\.\.\.)?$/, "...")); }; }); }); </script> </head> <body> <div class="test_demo"> 超酷的IT技术学习平台(我是省略号)大是大非防守打法范德萨发生 </div> <div class="figcaption"> <p> You probably can't do it (currently?) without a fixed-width font like Courier. With a fixed-width font every letter occupies the same horizontal space, so you could probably count the letters and multiply the result with the current font size in ems or exs. Then you would just have to test how many letters fit on one line, and then break it up.</p> </div>
相关文章推荐
- JQuery 控制内容长度超出规定长度显示省略号
- jquery控制td里面超出部分写省略号..
- JQuery 控制内容长度超出规定长度显示省略号
- css控制标题长度超出部分显示省略号
- css控制标题长度超出部分显示省略号
- JQuery---长度超出显示省略号
- CSS控制文字只显示一行 超出部分显示省略号
- jQuery截取超出字符串,并用省略号代替
- CSS控制文本超出指定宽度后用省略号代替,CSS控制文本不换行
- CSS控制TD内的文本超出指定宽度后不换行而用省略号代替
- 用jquery 实现 超出字符 截断并加上省略号(自定义jquery函数)
- jquery控制文字内容溢出用点点点(…)省略号表示
- css 样式控制文字长度,超出的以省略号代替
- jquery.ellipsis.js段落超出省略号插件
- css 控制文本超出范围的省略号
- CSS控制显示超出部分,用省略号显示
- CSS控制文本超出指定宽度后用省略号代替,CSS控制文本不换行
- css控制文本超出部分用省略号表示
- jquery控制层不超出屏幕范围
- CSS样式控制一行文字超出部分显示省略号 text-overflow:ellipsis