Hello, I wondered how I could close the modalframe, by just clicking on the area around the modalframe (in other words, by clicking on any spot outside the modalframe).

I googled "jquery and close dialogs" and found this piece of code:

$('.ui-widget-overlay').live('click', function() {
$(".dialogClass").dialog( "close" );
});

I tried to add this to ui.dialogs.js and it didn't work, unfortunately.
How could I close modalframes by clicking outside them?

Comments

thedavidmeister’s picture

This works for me

<script>
    /* close the modal box when the user clicks outside its bounds */
    $('.ui-widget-overlay').live('click', function(e){
      Drupal.modalFrame.close();
    });
</script>
thedavidmeister’s picture

Issue summary: View changes

edit

dsnopek’s picture

Issue summary: View changes
Status: Active » Fixed

@thedavidmeister's solution looks good! Add that to your theme or in a custom module.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.