1

How can I prevent closing CTools modal window with ESC key during AJAX request?

0

Try this one

/**
 * Override Ctools modal content function to prevent closing the modal with
 * the escape key.
 */
Drupal.CTools = Drupal.CTools || {};
Drupal.CTools.Modal = Drupal.CTools.Modal || {};
var modalContent = Drupal.CTools.Modal.modalContent;
Drupal.CTools.Modal.modalContent = function(content, css, animation, speed, modalClass) {
  modalContent(content, css, animation, speed, modalClass);
  $(document).unbind('keydown', modalEventEscapeCloseHandler);
}
| improve this answer | |
  • This method prevents pressing ESC always. I need to prevent pressing ESC only during AJAX request was sent. – qzmenko Jun 13 '16 at 6:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.