简体   繁体   English

轻击关闭时,引导模态弹出窗口打开

[英]Bootstrap modal popup open when tap close

Hi i have created bootstrap model for asking customer feedback. 嗨,我创建了引导模型来询问客户反馈。 This model will show when user try to close tap or browser. 当用户尝试关闭水龙头或浏览器时,将显示此模型。 Help me. 帮我。

Model : 型号:

<div id="myModal" class="modal fade" role="dialog">
      <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
          </div>
          <div class="modal-body">
            <div class="popupBG1">

                <div class="popupCTARow">
                    <div class="popupCTA1">
                        <a href="javascript:void(0);">Ok</a>
                    </div>
                    <div class="popupCTA2">
                        <a href="javascript:void(0);">Cancel</a>
                    </div>
                </div>
           </div>
    </div>  

Javascript : Javascript:

<script type="text/javascript">
        $(document).ready(function() {
            $("#myModal1").modal('show');
        });    
</script>

You can't show bootstrap modal when users try to leave, but you can show prompt, if that's what you want: 当用户尝试离开时,您无法显示引导模式,但是如果您想要的话,您可以显示提示:

window.onbeforeunload = function(){
  return 'Are you sure you want to leave?';
};

https://codepen.io/kastriotcunaku/pen/xLrVRb https://codepen.io/kastriotcunaku/pen/xLrVRb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM