看css发现一个pointer-events:none;的东西

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS:pointer-events</title>
<style type="text/css">
    .overlay1 {
        width:80px;
        height:20px;
        background:gold;
        position:absolute;
        top:5px;
        left:5px;
        opacity:0.5;
    }
    .overlay2 {
        width:80px;
        height:20px;
        background:gold;
        position:absolute;
        top:40px;
        left:5px;
        opacity:0.5;
    }
    .pointer{pointer-events:none;}
</style>
<script type="text/javascript">
window.onload = function(){
    document.getElementById('chx').onclick = function(){
        document.getElementById('a').className 
            = "overlay1 " + ((this.checked)? "pointer" : "");
        document.getElementById('b').className 
            = "overlay2 " + ((this.checked)? "pointer" : "");
    }
}
</script>
</head>
<body>
    <div id="a" class="overlay1"></div>
    <div id="b" class="overlay2"></div>
    <a href="http://mail.sina.com.cn">SinaMail</a>
    <br/><br/>
    <span onclick="alert(3);">SinaMail</span>
    <p>
        <input id="chx" type="checkbox">
        <label for="chx">开启穿透点击</label>
    </p>
</body>
</html>

http://www.cnblogs.com/snandy/archive/2011/03/17/1986807.html

posted @ 2013-12-27 14:58  方方和圆圆  阅读(604)  评论(0编辑  收藏  举报

再过一百年, 我会在哪里?