ColorBox Onclose function not working

Satch3000 picture Satch3000 · Jan 4, 2012 · Viewed 19.4k times · Source

I am trying to open a new colorbox window when one is closed.

I'm using this code:

$(".inline").colorbox({
    inline: true, 
    width: "50%", 
    escKey: false,
    onClose: function() {
        $('#newWindow').show();
    }

If there anything wrong with this code?

Answer

dknaack picture dknaack · Jan 4, 2012

Description

Assuming your using jack moore's colorbox jQuery plugin you have to change onClose to onClosed and use open:true. And you always have to close the function.

Check out the jsFiddle Demonstration.

Sample

Html

<div class="firstColorBox">first</div>
<div class="secondColorBox">second</div>

jQuery

$(".firstColorBox").colorbox({
    inline:true, 
    width:"50%", 
    escKey:false,
    onClosed:function(){
        // open the other colorBox
        $(".secondColorBox").colorbox({
                inline:true, 
                width:"50%", 
                escKey:false,
                open:true
        });     
    }
});

More Information

Update