I've been working on implementing a popup on my existing page that opens 4.5 seconds after the page loads. I want to add a blur effect to the background when the popup appears. I've tried various methods to add the blur effect to the main div, but it seems that the popup itself is getting blurred instead of the main background div. Below is the code snippet of what I have tried so far.
function PopUp(hideOrshow) {
if ( hideOrshow == 'hide' )document . getElementById( 'ac-wrapper' ) . style . display = "none";
else document . getElementById( 'ac-wrapper' ) . removeAttribute( 'style' );
}
window . onload = function () {
setTimeout( function () {
PopUp( 'show' );
}, 4500 );
}
#ac-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .6);
z-index: 1001;
-webkit-filter: blur(2px);
-moz-filter: blur(2px);
-o-filter: blur(2px);
-ms-filter: blur(2px);
filter: blur(2px);
}
#popup {
width: 555px;
background: #f6f6f6;
border-radius: 25px;
-moz-border-radius: 25px;
-webkit-border-radius: 25px;
box-shadow: #64686e 0px 0px 3px 3px;
-moz-box-shadow: #64686e 0px 0px 3px 3px;
-webkit-box-shadow: #64686e 0px 0px 3px 3px;
position: relative;
top: 20%;
left: 36%;
padding: 25px;
/*-webkit-filter: blur(0);
-moz-filter: blur(0);
-o-filter: blur(0);
-ms-filter: blur(0);
filter: blur(0);*/
}
.popup-close {
width: 20px;
float: right;
}
.popup-logo {
width: 180px;
margin-top: 25px;
}
.pmh-top {
margin-top: 20px;
color: #4D4D4E;
}
.pmp-top {
margin-top: 10px;
}
.pm-list {
list-style: none;
margin-left: 0px;
padding-left: 0px;
}
.pm-list li {
height: 40px;
margin-bottom: 10px;
padding-left: 45px;
padding-top: 10px;
}
.reference-id {
background-image: url("<?php echo base_url(); ?>assets/frontend/images/popup/reference-id.png");
}
.company-info {
background-image: url("<?php echo base_url(); ?>assets/frontend/images/popup/company-info.png");
}
.reference-id,
.company-info {
background-repeat: no-repeat;
background-size: auto;
}
.popup-field {
text-align: center;
}
.popup-btn {
width: 100% !important;
background-color: #27546B !important;
color: #FFFFFF !important;
}
.pmp-bottom {
font-size: 11px;
line-height: 17px;
margin-top: -10px;
}
.blur {
-webkit-filter: blur(2px);
-moz-filter: blur(2px);
-o-filter: blur(2px);
-ms-filter: blur(2px);
filter: blur(2px);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div>this is complete website normal background page, I am trying to blur<div>
<div id="ac-wrapper" style='display:none;'>
<div id="popup">
<a href="<?php echo base_url() ; ?>"><img src="<?php echo base_url() ; ?>assets/frontend/images/popup/cross-icon.png" alt="close popup" class="popup-close" /></a>
<img src="<?php echo base_url() ; ?>assets/frontend/images/popup/logo.png" alt="logo" class="popup-logo" />
<h2 class="pmh-top">We'll email prices for safe keeping!</h2>
<p class="pmp-top">The email contains the following</p>
<ul class="pm-list">
<li class="reference-id">Your reference ID for quick booking</li>
<li class="company-info">Information regarding Us</li>
</ul>
<form method="post">
<input type="email" placeholder="Enter your email address" class="popup-field" />
<input type="submit" value="View Prices Now" class="popup-btn" onClick="PopUp('hide')" />
</form>
<p class="pmp-bottom">Keeping your information safe is key to us, all information you entered will be kept safe in compliance to law.</p>
</div>
</div>
Despite my best efforts, the popup is getting blurred instead of the background. Any assistance on this issue would be greatly appreciated. Thank you in advance!