How to close KendoUI modal window when click on overlay outside window?

user1762608 picture user1762608 · Jan 14, 2014 · Viewed 9.4k times · Source

I have Kendo UI modal window opened and I want to close it by clicking on overlay. How can I do that?

Answer

Lars Höppner picture Lars Höppner · Jan 14, 2014

Try something like this:

var dialog = $("#dialog2").kendoWindow({
    modal: true
}).data("kendoWindow").center();

$(document).on("click", ".k-overlay", function () {
    dialog.close();
});

(demo)