<!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8"> <title>用jquery做遮罩</title> <style> .all{ width:100%; height:500px; background: red; position: relative; } .mask { width:100%; height:500px; position: absolute; display: none; background:rgba(0,0,0,.5); z-index:1000; } </style></head><body> <div class="all"> <div id="mask" class="mask"></div> </div></body><script src="jquery-1.11.3.min.js"></script><script> (function(){ $(function(){ $(".all").click(function () { $("#mask").slideToggle(1000); }); }); })()</script></html>jQuery的代码一点点,是不是简单啊!!!哈哈哈
时间: 2024-10-15 22:19:41