我的页面中包含省略号的动态数据.含义:
.my-class
{
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
width: 71px;
}
Run Code Online (Sandbox Code Playgroud)
并且我想添加具有相同内容的此元素工具提示(title ='$ {myData}')但我希望它仅在内容很长并且省略号出现在屏幕上时才会出现.
有什么办法吗?
一个方向 - 当浏览器(在我的情况下是IE)绘制省略号时 - 它会抛出一个关于它的事件吗?
我想知道有一种方法可以检测text-overflow:ellipsis输入字段是否处于活动状态,这样我就可以显示带有全文的工具提示.
CSS:
input[type='text']
{
text-overflow:ellipsis;
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<input type="text" onmouseover="Tooltip.Show(this)" value="some long text" />
Run Code Online (Sandbox Code Playgroud)
使用Javascript:
Tooltip.Show = function (input)
{
// This is where i need the see if the current input show ellipsis.
if ($(input).isEllipsisActive())
{
// Show the tooltip
}
}
Run Code Online (Sandbox Code Playgroud)
BR
安德烈亚斯