2

Please help me to make overlay closed on background click. I am trying with following code but it is not working:

jQuery('.overlay-modal-background').live('click', function(e) {
  Drupal.overlay.close();
});
  • Hello and welcome. "it is not working" is both most popular and most useless report in IT. Does it parse at all? Does it throw any errors? What errors? Is it executed? Please explain how it fails. Also, see Managing JavaScript in Drupal 7. Is this code proper Drupal behavior? How do you include it in your page? – Mołot Aug 14 '14 at 7:16
  • Which version of jQuery are you using? Default jQuery from Drupal or using JQuery Update module? live() method is introduced in jQuery 1.7 – Елин Й. Aug 15 '14 at 14:07
  • 1
    @ЕлинЙ. Nope, live() was deprecated in 1.7 – Clive Aug 15 '14 at 14:15
  • @Clive you're right, I've mistaken it for on() method. – Елин Й. Aug 15 '14 at 19:28

Your Answer

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

Browse other questions tagged or ask your own question.