when div with absolute position is added cannot click on links

前端 未结 8 1418
情歌与酒
情歌与酒 2021-01-01 10:37

I have menu on a page and div that is absolute positioned. The problem is that when this div is on a page, then I cannot click on any links in menu items.

When I re

8条回答
  •  温柔的废话
    2021-01-01 10:52

    put z-index:1 to that component which has absolute property.

    for example:

    function myFunction() {
      document.getElementById("print").innerHTML = "Hello World";
    }
    .custcontainer {
        position: relative;
        
    }
    .custcontainer .like {
        position: absolute;
        top: 18%;
        left: 10%;
        transform: translate(-50%, -50%);
        -ms-transform: translate(-50%, -50%);
    
        cursor: pointer;
        font-size:30px;
        text-align: center;
        z-index: 1;
    }

提交回复
热议问题