Is it possible to add these two as options?

Comments

aritra.ghosh’s picture

Though I admit this may be a bit hackish, but i achieved the close on click outside the modal with this piece of js code:

$('#modalBackdrop').click(function() {
$('.popups-close').trigger('click');
});

Hope this helps!!

sincronista’s picture

I have tried to add this function to my site without any luck.

I added your piece of code to my modal_forms_login.js file (because I am using the module only for my login window).

Could you give more details on where to add the code?

Thanks!

caiosba’s picture

You can do the following too:

// JavaScript
$('#modalBackdrop').click(function() {
   Drupal.CTools.Modal.dismiss();
});

Or add the line below to ctools/js/modal.js (around line 430):

// JavaScript
$('#modalBackdrop').click(function() { close(); });
chrinor2002’s picture

Issue summary: View changes

Add the following to any of your JS documents (such as one that is included for your theme):

// JavaScript
Drupal.behaviors.ctools_backdrop_close = {
  attach: function(context, settings){
    $('#modalBackdrop').once('ctools_backdrop_close', function(){
      $(this).click(function() {
        Drupal.CTools.Modal.dismiss();
      });
    });
  }
}
cosolom’s picture

chrinor2002, thank you for elegant solution

hamrant’s picture

chrinor2002, thank you

firewaller’s picture

#4 works great for me! Would love to see this added as an optional setting in the module.

firewaller’s picture

Status: Active » Reviewed & tested by the community