如果一个游戏上面加一个透明层,js能不能实现 点击透明层的任意点 而正常玩游戏


<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script src="jquery.min.js"></script> </head> <style> .div0{z-index: 0;width: 1124px;height: 600px;background: red;position: absolute;top:0;} .div1{z-index: 1;width: 1024px;height: 500px;background: #000;position: absolute;top:0;pointer-events:none;} </style> <body> <div class="div0"> hhshshshs </div> <div class="div1"> </div> </body> <script> $('.div1').click(function(){ alert("我是浮层") }) $('.div0').click(function(){ alert("我是底层") }) </script> </html>

css3的一个属性:

/*该层点击事件无效,传递到下层*/
    .pointer{pointer-events:none;}

 

posted @ 2016-04-07 16:03  Cynthia娆墨旧染  阅读(378)  评论(0编辑  收藏  举报