thinhunan / jquery.ellipsis.js Goto Github PK
View Code? Open in Web Editor NEW自动计算内容宽度截断,并加上省略号,内容不受中英文或符号限制
自动计算内容宽度截断,并加上省略号,内容不受中英文或符号限制
您好,看到您写的这个插件了,很赞!就是有个疑问,想请教一下:
var text = $.trim($elem.text()).replace(' ',' '); //for fix white-space bug
不知道这里的white-space bug指的是什么?
好像没有找到代码的许可协议?
div p {
display: block;
font-size: 14px;
font-family: 'Microsoft YaHei';
/* overflow: hidden; /
width: 200px;
float: left;
/ line-height: 24px; */
height: 70px;
border: 1px solid navy;
-ms-word-break: break-all;
word-break: break-all;
clear: both;
}
会失效
p {
display: block;
font-size: 14px;
font-family: 'Microsoft YaHei';
/* overflow: hidden; /
width: 200px;
float: left;
/ line-height: 24px; */
height: 70px;
border: 1px solid navy;
-ms-word-break: break-all;
word-break: break-all;
clear: both;
}
则不会。
你只算了text.length,我感觉是不是有可能不太准,是否应该加一letter-spacing之类的东西?
maxLine,最大亮度
应该是最大行数吧
如题 我的目标元素字体是继承父级的 clone出来的是继承浏览器的 两者有区别 算出来的宽度有误差
引用jq和js之后,再找到DOM引用.ellipsis({maxWidth:100,maxLine:1}),结果只是首字跟三个点,是什么原因??
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.