views:

297

answers:

1

Hi everyone, I have a jquery colorbox application.In this application,When i click a link,a jquery colorbox modal box opens and it contents come from external link.There is a button inside of the content and i want to close colorbox window when i click that button.Is there any way to close colorbox modal window?There is colorbox's own closing button but i dont want to use that because my application needs a button in order to close it. I used $.fn.colorbox.close(); when click button but it didn't work. Thanks for advance...

+1  A: 

Try attaching a jQuery live event to the button. Assuming you add a button with class closebutton to the color box content:

$('#cboxContent .closebutton').live('click', function(){
 $.fn.colorbox.close();
});
fudgey
I put it in the external content page but it didn't work
cubuzoa
It should be added to the main page, not the external content page. External content javascript is automatically disabled by jQuery.
fudgey