Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ColorBox Onclose function not working

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?

like image 235
Satch3000 Avatar asked Jan 04 '12 14:01

Satch3000


1 Answers

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

  • jsFiddle Demonstration
  • jack moore's colorbox jQuery plugin

Update

like image 172
dknaack Avatar answered Oct 02 '22 15:10

dknaack