Full example of jquery popup mask effect

Source: Internet
Author: User

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > "http://www.w3.org/1999/xhtml"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>jQuery 遮罩层</title><style type="text/css">/* 半透明的遮罩层 */#overlay {  background: #000;  filter: alpha(opacity=50); /* IE的透明度 */  opacity: 0.5; /* 透明度 */  display: none;  position: absolute;  top: 0px;  left: 0px;  width: 100%;  height: 100%;  z-index: 100; /* 此处的图层要大于页面 */  display:none;  _ padding:0px 0px 0px 5px; background-image:initial; background-position:initial; background-size:initial; background-repeat:initial; background-attachment:initial; background-origin:initial; background-clip:initial; BORDER-LEFT:3PX Solid RGB (108, 226, 108); line-height:20px; width:640px; Clear:both; border-radius:0px!important; border-top:0px!important; border-right:0px!important; border-bottom:0px!important; Border-image:initial!important; Bottom:auto!important; Float:none!important; Height:auto!important; Left:auto!important; outline:0px!important; Overflow:visible!important; Position:static!important; Right:auto!important; Top:auto!important; Vertical-align:baseline!important; Box-sizing:content-box!important; Font-family:consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace!important; Min-height:auto!important; Color:gray!important; " > #a0a0a0; /* Resolve IE6 opacity issues */}</style><script type="text/javascript" src="jquery-1.7.2.min.js"></script><script type="text/javascript">/* 显示遮罩层 */function showOverlay() {  $("#overlay").height(document.body.scrollHeight);  $("#overlay").width(document.body.scrollWidth);  // fadeTo第一个参数为速度,第二个为透明度  // 多重方式控制透明度,保证兼容性,但也带来修改麻烦的问题  $("#overlay").fadeTo(200, 0.5);  // 解决窗口缩小时放大后不全屏遮罩的问题  // 简单来说,就是窗口重置的问题  $(window).resize(function(){    $("#overlay").height(document.body.scrollHeight);    $("#overlay").width(document.body.scrollWidth);  });}/* 隐藏覆盖层 */function hideOverlay() {  $("#overlay").fadeOut(200);}</script><body><button onClick="showOverlay();" style=" width:100px; height:60px; margin:40px auto 40px auto; display:block;">打开遮罩层</button><button onClick="hideOverlay();" style=" width:100px; height:60px; z-index:101; display:block; position:absolute; left:10px; top:10px;">关闭遮罩层</button>

"center"><a href="http://www.jb51.net/">阅谁问君诵,水落清香浮。</a><div style="height:10000px;"></div><div id="overlay"></div></body>

Full example of jquery popup mask effect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.