Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- $(document).ready(function(){
- var window = $("#window");
- var okButton = $("#okButton");
- var openButton = $("#openButton");
- //attach click event to the open button
- openButton.on("click", function(){
- //open kendo window
- window.data("kendoWindow").open();
- //hide open button
- openButton.hide();
- });
- //attach click event to the OK button
- okButton.on("click", function(){
- //close kendo window on
- window.data("kendoWindow").close();
- });
- //handler function for window's close event
- var onClose = function(){
- openButton.show();
- };
- //handler function for window's activate event
- var onActivate = function(){
- //the ok button must have the focus on it in order to intercept the keypress event
- okButton.focus();
- };
- if (!window.data("kendoWindow")) {
- window.kendoWindow({
- width: "600px",
- title: "My window",
- close: onClose,
- activate: onActivate,
- visible: true
- });
- }
- //centers the window on the page
- window.data("kendoWindow").center();
- //handler funtion for the keypress event
- $("#window").keypress(function(event){
- //if the key press is ESC
- if (event.keyCode === 27) {
- //close the KendoUI window
- window.data("kendoWindow").close();
- }
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement