Redirect parent after close of form submission lightbox


#1

Hi,

I’m trying to send the user to my actual website automatically after receiving the success message from completing a form submission.

When the form is complete the lightbox pops up, but I can’t manage to redirect them after they close the lightbox.

I’ve tried this:

var closelightbox = document.getElementById('element-id');
closelightbox.onclick = redirectPage;

function redirectPage() {
	window.top.location.href = "https://www.example.com"; 
	return false;	
}

For element-id, I have used:

ubpoverlay-overlay
ubpoverlay-close

It works on elements within the lightbox but not anything outside of the lightbox. Essentially I want to click anywhere on the page and be redirected.

And just body wide:

$(document.body).click(function() {
window.top.location.href = "https://www.example.com"; 
});

Any ideas?

Thanks


#2

Hey @Savage I believe this is what you’re looking for http://jsfiddle.net/73hutxe3/ let me know if that works for you.


#3

Hi @digibomb,

Thanks for your reply. I don’t think Unbounce uses featherlight?

It has it’s own script here: http://builder-assets.unbounce.com/published/jquery.ubpoverlay-d9900bb.z.js

But I can’t work out how to edit the ‘onClosed’ event, similar to what your answer has suggested.

Cheers,


#4

Hi @Savage,

Here is an older community thread related to your question.

You can find some example scripts there and adjust based on your particular case.


#5

Hi @Hristian

Perfect, thanks very much.


#7

Hey @Savage you are correct, was just an example :slight_smile: But, I see @Hristian has provided and answer as well, I hope this has done the job.