Close Popup With Button Click
T
Theo Gilardo
At the moment, it is only possible to close the popup by clicking on the top-right cross. It would be nice to also allow users to close the popup with a Button click. At the moment, this option is not available but it would be a great addition. This would be useful in a VSL page, if the user try to exit the page, we tell them to stick to the page with a popup and tell them to keep watching the video. So the button in the popup would say "Keep Watching Now" for instance, then the user would click on it and close the popup to watch the full video.
Log In
R
Rob Calhoun
I ran into this today. Use case:
We needed to add a preliminary step to an existing process. The best solution was to use a pop up to ask a yes or no question. Yes goes to a new different page. No simply closes the popup and continues the original.
It seemed simple enough. But there is no close popup action for buttons.
Related requests:
I
Ihsan Khan
Just spend an hour trying to find a solution for it.
Nothing worked with the native button so I just went ahead and used a custom code element for the button as well.
You can customize the background color and the text. Everything else should work fine.
<button onclick="hideModel()" class="radius4 noBorder button-vp-15 btn-hp-40 buttonRocking" aria-label="Click to Continue"
style="background-color: var(--color-lr2bh3nk);color: white;font-family: var(--contentfont);font-weight: 700;padding: 12px 25px;font-size: 18px;margin: 0 auto;display: block;cursor: pointer;"
>Click to Continue</button>
<script>
function hideModel() {
document.getElementById("overlay").style.display = "none";
}
</script>
M
Mahinur Khan
Ihsan Khan there was an issue where the popup would open only once. However, your code was super helpful, and I fixed everything by modifying it. Now it can be used in any popup and gives full flexibility to close and reopen the popup.
Here's the code:
I
Ihsan Khan
Mahinur Khan good!