How to overlay a div (or any element) over a table row (tr)?

后端 未结 6 1105
轮回少年
轮回少年 2021-01-30 12:58

I\'d like to overlay a div (or any element that\'ll work) over a table row (tr tag) that happens to have more than one column.

I have tried a few methods, which don\'t s

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-30 13:11

    You need to make the overlay div have an absolute position. Also use the position() jQuery method for top and left positions of the row - here are the missing pieces:

    var rowPos = $divBottom.position();
    bottomTop = rowPos.top;
    bottomLeft = rowPos.left;
    
    //
    $divOverlay.css({
        position: 'absolute',
        top: bottomTop,
        left: bottomLeft,
        width: bottomWidth,
        height: bottomHeight
    });
    

提交回复
热议问题