HTML多出文本,用省略号解决的办法

来源:互联网 发布:优化排名工具 编辑:程序博客网 时间:2024/05/22 12:07

http://c7sky.com/text-overflow-ellipsis-on-multiline-text.html


解决文本多出,只显示省略号的的问题


$(".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)(\.\.\.)?$/, "..."));    };});

0 0
原创粉丝点击