HTML/CSS: Make a div “invisible” to clicks?

后端 未结 5 1035
清歌不尽
清歌不尽 2020-11-28 06:37

For various reasons, I need to put a (mostly) transparent

over some text. However, this means that the text can\'t be clicked (eg, to click links or
5条回答
  •  执笔经年
    2020-11-28 06:47

    You can do this by hiding the overlay like this:

    overlay.onclick = function(){
        window.event.srcElement.style.visibility = "hidden";
        var BottomElement = document.elementFromPoint((navigator.appName.substring(0,3) == "Net") ? e.clientX : window.event.x,(navigator.appName.substring(0,3) == "Net") ? e.clientY : window.event.y);
        window.event.srcElement.style.visibility = "visible";
        BottomElement.click();
    }
    

提交回复
热议问题