Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Esc close for colorbox

I'm using the colorbox plugin for jQuery.

I know I don't have to have a close button, and overlayClose: false will prevent the window from being closed by clicking the overlay.

Is there a way to remove the Esc key-listener event?

like image 940
Derek Adair Avatar asked Apr 08 '10 13:04

Derek Adair


2 Answers

property -> escKey:false

like image 83
Roland Avatar answered Nov 18 '22 22:11

Roland


From looking at the source, the escape key is bound to the keydown.cbox_close event from line 165:

    // Set Navigation Key Bindings
    $(document).bind("keydown.cbox_close", function (e) {
            if (e.keyCode === 27) {
                    e.preventDefault();
                    cboxPublic.close();
            }
    ...

You could comment out that binding, or use it for some other purpose.

like image 27
karim79 Avatar answered Nov 18 '22 21:11

karim79