First off I am new to Javascripting and ColorBox and have been trying for 4 days now to get this to work. I am sure it is relatively simple, but I just can't seem to get things right.
I have a main page which has a link which open a ColorBox using an IFrame to load a PHP page to allow data input. I would like the ColorBox to close once the user saves the data.
I found this http://stackoverflow.com/questions/2101011/how-to-close-colorbox-within-iframe but sadly the solution from the last post does not work in my case?!
I use the following in the main page to launch the ColorBox
$(document).ready(function(){
$(".newEntry").colorbox({width:"80%", height:"80%", iframe:true, onClosed:function(){location.reload();}});
});
The in the PHP page I have tried various things. I use the $done variable to only close the ColorBox if the data save was successful.
if($done==FALSE){ echo ' $(document).load(function() { parent.$.fn.colorbox.close(); window.close(); parent.$(".iframe").colorbox.close(); });'; }
If someone could show me what to do and, even better, explain a little, it would be greatly appreciated!
Also, on a side note, is there a way to make a ColorBox modal, so the ColorBox remain in focus until it is closed?
Thank you for all your help.