How to show a table as a tooltip using jQuery?

偶尔善良 提交于 2019-12-24 00:55:05

问题


I have a Gridview populated with data and one of the column contains a Link Button (File List). If I click on the Linkbutton (FileList) a .net event will be fired and a call will be made to the database to retrieve the data.

How to show that data in a HTML table format as a tool-tip as shown in the attached picture? I would like to achieve the tooltip using jQuery.


回答1:


Simple example:

HTML

<a href="">test</a>
<table>
    <tr><td>asdf</td><td>gsdi</td></tr>
    <tr><td>asdf</td><td>gsdi</td></tr>
</table>

JS

$('a').hover(function(ev){
    $('table').stop(true,true).fadeIn(); 
},function(ev){
    $('table').stop(true,true).fadeOut();
}).mousemove(function(ev){
    $('table').css({left:ev.layerX+10,top:ev.layerY+10});
});

CSS

table{
    display:none;
    position:absolute;
}
td{
    border:1px solid red;   
}

Fiddle demo



来源:https://stackoverflow.com/questions/7654711/how-to-show-a-table-as-a-tooltip-using-jquery

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!