How to add a pop-up to a website?

A pop-up is a great way to share key information with all visitors to your website. It can be used to display messages or promotional offers. Popup

If you want to add a pop-up to your site, follow the steps below:

1. Add JavaScript code in the custom.js file

Place the following code in the custom.js file within the Developer section. This will provide the necessary functionality for your pop-up.

$(document).ready(function() {

// Check the current URL

if (window.location.href === "https://event.conrego.app/") {

// Display the pop-up after the page loads

$('#popup-overlay').fadeIn();

// Close the pop-up when the button is clicked or tapped

$('#popup-close').on('click touchstart', function() {
            $('#popup-overlay').fadeOut();
        });
    }
});

2. Next, add the code below to custom.css

#popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
}

#popup {
    position: relative;
    margin: 5% auto;
    background-color: white;
    padding: 20px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    z-index: 1100;
}
#popup h2 {
  margin: 0 0 15px;
  font-size: 18px;
  text-align: center;
}
#popup p {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 10px;
}
#popup-close {
 display: block;
 margin: 10px auto 0;
 padding: 10px 20px;
 background-color: #e22989;
 color: white;
 text-align: center;
 border: none;
 border-radius: 5px;
 cursor: pointer;
 text-decoration: none;
 font-size: 14px;
}
#popup-close:hover {
    background-color: #7cc9de;
      }

@media (max-height: 600px) {
    #popup {
        max-height: 90%;
        overflow-y: auto;
    }
}

3. The final step is adding the following code to the header.html section]

<div id="popup-overlay">
    <div id="popup">
      <p>
        Your content
      </p>
        <a id="popup-close">Close</a>
    </div>
</div>

Visit your site and check out how your pop-up looks. Adding a pop-up is a great way to improve communication with your users—use it wisely!