layui点击table表格的每一格时显示相应的内容

 1   $(document).on('click','.layui-table-cell',function(){
 2         // $("p").css({"background-color":"blue","font-size":"14px"});
 3        var x=$(this).offset(),
 4            left=x.left,
 5            top=x.top;
 6         var w=$(this).width(),
 7             h=$(this).height();
 8         $('.hoverDiv').css({
 9             "width":w,
10             "left":left+"px",
11             "top":top+h+'px',
12             "display":'block',
13             "background":'pink',
14         }).slideDown();
15     })

 

posted @ 2018-05-21 15:30  前端极客  阅读(9383)  评论(0编辑  收藏  举报