简体   繁体   English

将长表格单元格内容隐藏在工具提示中

[英]Hiding long table-cell content in a tooltip

I have an HTML table that has some cells with very large amounts of content (eg 1KB). 我有一个HTML表,其中包含一些单元格,这些单元格的内容非常大(例如1KB)。 Most of the cells have much less than this, 15 bytes or so. 大多数单元的容量远小于此值,大约15个字节。

I want to hide the large content in a tooltip. 我想将大量内容隐藏在工具提示中。 What's the best way to do this? 最好的方法是什么? Eg show the first 15 bytes or so with a "..." then let a user hover or click to see the rest (or alternately, not even show the first 15 bytes if that's not easy) 例如用“ ...”显示前15个字节左右,然后让用户悬停或单击以查看其余部分(或者,如果不容易,甚至不显示前15个字节)

We're using Bootstrap if that makes any difference. 如果有任何不同,我们正在使用Bootstrap。

The most simple possible implementation is ... ( Working example here ) 可能最简单的实现是...( 此处工作示例

<div
    onmouseover="document.getElementById('Overflow1').style.display='inline'"
    onmouseout="document.getElementById('Overflow1').style.display='none'">

    Lorem ipsum dolor sit amet,     
    <span id="Overflow1" style="display: none">
        consectetur adipiscing elit. Fusce a erat non nunc facilisis pulvinar. Ut dignissim ut nisi eu porttitor. Nulla cursus, dolor fringilla ullamcorper dictum, arcu orci faucibus sem, ullamcorper mattis odio sapien quis tortor. Proin dictum vel neque non malesuada. Pellentesque at consectetur augue. Curabitur ipsum est, posuere commodo feugiat quis, suscipit at neque.
    </span>
</div>

Of course for cleaner code, you should consider factoring out methods (or even better, adding event handlers using jQuery ) 当然,对于更简洁的代码,您应该考虑分解方法(或更妙的是, 使用jQuery添加事件处理程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM