开发者

Disable Esc close for colorbox

开发者 https://www.devze.com 2022-12-25 21:30 出处:网络
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.

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?


property -> escKey:false


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.


As overlayClose: false, for ESC you can make escKey:false

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号