如何显示“...”当没有足够的空间来查看所有文本时
当没有足够的空间来查看所有文本时,jQueryMobile 如何显示“...”?
它是 CSS 属性吗?
How does jQueryMobile shows "..." when there's not enough space to view all the text?
Is it an CSS attribute?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为此有一个 CSS 属性——它是
text-overflow:ellipsis;
。然而,它有一个问题:它在 Firefox 中不起作用。它适用于所有其他浏览器,但不适用于 Firefox,甚至不适用于 FF4。据我所知,它计划用于 FF5 或 FF6。
在 Firefox 中,需要使用纯 Javascript 来完成,这就是 JQuery 需要做一些工作的地方。为了准确地做到这一点,需要逐个字符地计算文本的物理大小(以像素为单位)。它可能确实在其他浏览器中使用了 CSS 属性。这是有道理的。
请参阅这篇文章:text-overflow:Firefox 4 中的省略号? (和 FF5) 针对 Firefox 进一步讨论此问题。
There is a CSS attribute for this -- it is
text-overflow:ellipsis;
.However, there is one problem with it: it doesn't work in Firefox. It works in all other browsers, but not Firefox, not even FF4. I understand it's planned for FF5 or FF6.
In Firefox, it would need to be done using pure Javascript, which is where the JQuery would need to do some work. To do it accurately, it would need to calculate the physical size of the text in pixels, character by character. It is possible that it does use the CSS property in other browsers. It would make sense.
See this post: text-overflow:ellipsis in Firefox 4? (and FF5) for a further discussion of this issue specific to Firefox.