<!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; 1124px;height: 600px;background: red;position: absolute;top:0;} .div1{z-index: 1; 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;}