编程语言
首页 > 编程语言> > javascript – 显示模态弹出基础:防止关闭弹出窗口

javascript – 显示模态弹出基础:防止关闭弹出窗口

作者:互联网

我正在使用reveal-modal popup http://foundation.zurb.com/docs/components/reveal.html.

是否存在内置方法以防止关闭esc键上的弹出窗口.或者我怎样才能让它发挥作用?

我试过以下,

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

链接到打开弹出窗口

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

弹出

    <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");
    };

在foundation.reveal.js

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'
    }
  }
}

但仍然没有工作.

请帮忙,
谢谢.

解决方法:

终于找到了:

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

标签:javascript,jquery,zurb-foundation,popup
来源: https://codeday.me/bug/20190722/1505893.html