Display modal popup: prevent the popup from being closed

I am using the open-modal popup http://foundation.zurb.com/docs/components/reveal.html .

There is a built-in method to prevent the popup from closing on the esc key. Or how can I get it to work?

I tried the following:

    $(document).keyup(function(e) {
      if (e.keyCode === 27) {
        return e.preventDefault();
      }
    });

      

Link to open popup

    <a class="action icon-primary" id="manageAccess" ng-click="Popup()"><img src="images/Manage_Access_Icon.svg"/>Access Pop up</a>

      

Popup

    <div id="AccessContainer" class="reveal-modal large" data-reveal data-options="close_on_background_click:false;">
        //contents inside pop-up
        <a class="close-reveal-modal">&#215;</a> // wil close pop-up
    </div>

    $scope.Popup = function() {
      return $("#AccessContainer").foundation("reveal", "open");
    };

      

In the foundation.reveal.js file

settings : {
  animation: 'fadeAndPop',
  animation_speed: 250,
  close_on_background_click: true,
  close_on_esc: true, // how can i change this from my js
  dismiss_modal_class: 'close-reveal-modal',
  bg_class: 'reveal-modal-bg',
  open: function(){},
  opened: function(){},
  close: function(){},
  closed: function(){},
  bg : $('.reveal-modal-bg'),
  css : {
    open : {
      'opacity': 0,
      'visibility': 'visible',
      'display' : 'block'
    },
    close : {
      'opacity': 1,
      'visibility': 'hidden',
      'display': 'none'
    }
  }
}

      

But still doesn't work.

Please help, Thanks.

+3


source to share


1 answer


Finally found:



data-options="close_on_background_click:false;close_on_esc:false;"

      

+9


source







All Articles