Question

Good Morning,

I am having trouble figuring out how to close a colorbox upon clicking "Click here to return to our website" and open a regular browser window. To see my problem, please visit this page:

http://online.saintleo.edu/about-us/press-releases.aspx

In the left navigation at the bottom in small text you will see a bulleted "Request Info". Just enter any text to pass through 2 step form and once you click "submit" you will see the thank you page which has the "Click here to return to our website". Again, I would like the colorbox to close at that point and the URL to open in a normal new browser window.

Could someone please assist? I would greatly appreciate the time and consideration. This is the code for the hyperlink in case this is helpful:

<a onclick="window.parent.jQuery.colorbox.close(); return false;" href="http://online.saintleo.edu/">Click here to return to our website</a>

Thank you again!

Was it helpful?

Solution

If you just want the URL to open in the same window, then try target="_parent" on your anchor tag... no need to close the colorbox via jquery if you are loading a new URL anyway.

So something like this should work:

<a target="_parent" href="http://online.saintleo.edu/">Click here to return to our website</a>

If, however, you want to open the link in a new browser window and close the colorbox on the current one... then you might want to consider writing a new function and calling that instead.

So something like this from within the iframe:

<a onclick="parent.myfunction();" href="#">Click here to return to our website</a>

And then a function similar to this one in the parent:

function myfunction() {
    $.colorbox.close();
    window.open('url');
    return false;
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top