我有下一个 div:
<div class="div-class" style="width:158px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;" title=<%=myDesc%>
如何仅在省略号处于事件状态时显示工具提示?
我找到了这个函数
function isEllipsisActive(e) {
return (e.offsetWidth < e.scrollWidth);
}
但是我知道我用的是jsp和struts,不知道怎么用
最佳答案
尝试这样的事情:
Working DEMO
Working DEMO - with tooltip
$(function() {
$('div').each(function(i) {
if (isEllipsisActive(this))
//Enable tooltip
else
//Disable tooltip
});
});
function isEllipsisActive(e) {
return (e.offsetWidth < e.scrollWidth);
}
关于css - 仅在省略号处于事件状态时显示工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19134192/