• <i id='r0Xw4'><tr id='r0Xw4'><dt id='r0Xw4'><q id='r0Xw4'><span id='r0Xw4'><b id='r0Xw4'><form id='r0Xw4'><ins id='r0Xw4'></ins><ul id='r0Xw4'></ul><sub id='r0Xw4'></sub></form><legend id='r0Xw4'></legend><bdo id='r0Xw4'><pre id='r0Xw4'><center id='r0Xw4'></center></pre></bdo></b><th id='r0Xw4'></th></span></q></dt></tr></i><div id='r0Xw4'><tfoot id='r0Xw4'></tfoot><dl id='r0Xw4'><fieldset id='r0Xw4'></fieldset></dl></div>
  • <tfoot id='r0Xw4'></tfoot>

    <small id='r0Xw4'></small><noframes id='r0Xw4'>

    <legend id='r0Xw4'><style id='r0Xw4'><dir id='r0Xw4'><q id='r0Xw4'></q></dir></style></legend>
    • <bdo id='r0Xw4'></bdo><ul id='r0Xw4'></ul>

      1. 当我在外面点击时,如何让这个弹出框消失?

        How do I make this popup box disappear when I click outside?(当我在外面点击时,如何让这个弹出框消失?)

      2. <small id='fPWVS'></small><noframes id='fPWVS'>

            <tbody id='fPWVS'></tbody>
              <bdo id='fPWVS'></bdo><ul id='fPWVS'></ul>
              <tfoot id='fPWVS'></tfoot>
                <legend id='fPWVS'><style id='fPWVS'><dir id='fPWVS'><q id='fPWVS'></q></dir></style></legend>
                <i id='fPWVS'><tr id='fPWVS'><dt id='fPWVS'><q id='fPWVS'><span id='fPWVS'><b id='fPWVS'><form id='fPWVS'><ins id='fPWVS'></ins><ul id='fPWVS'></ul><sub id='fPWVS'></sub></form><legend id='fPWVS'></legend><bdo id='fPWVS'><pre id='fPWVS'><center id='fPWVS'></center></pre></bdo></b><th id='fPWVS'></th></span></q></dt></tr></i><div id='fPWVS'><tfoot id='fPWVS'></tfoot><dl id='fPWVS'><fieldset id='fPWVS'></fieldset></dl></div>
                  本文介绍了当我在外面点击时,如何让这个弹出框消失?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  http://jsfiddle.net/mnbayazit/by3zy/2/

                  当我单击背景上的某个位置时,我希望弹出窗口消失.问题是,当我单击 [X] 或弹出窗口本身时,它会消失.

                  I want the popup to disappear when I click somewhere on the background. Problem is, it disappears when I click an [X] or the popup itself.

                  如果这让我的意图更清楚,想象一下它是一个日历选择器.

                  Imagine it being a calendar-picker if that makes my intentions more clear.

                  我怎样才能让它做到这一点?

                  How can I get it to do that?

                  推荐答案

                  1. 为主体设置一个 click 处理程序以删除您的弹出窗口.

                  1. Set a click handler for the body to remove your popup.

                  为弹出窗口本身设置一个 click 处理程序,该处理程序在事件上调用 stopPropagation(),以防止它冒泡到正文.

                  Set a click handler for the popup itself that calls stopPropagation() on the event, to prevent it from bubbling up to the body.

                  大致:

                  function showMyPopup(){
                    ...
                    $(myPopupDiv).click(function(e){
                      e.stopPropagation();
                    });
                  }
                  function closeMyPopup(){
                    ...
                  }
                  $(document.body).click(closeMyPopup);
                  

                  这篇关于当我在外面点击时,如何让这个弹出框消失?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Fetch multiple links inside foreach loop(在 foreach 循环中获取多个链接)
                  Backbone Fetch Request is OPTIONS method(Backbone Fetch Request 是 OPTIONS 方法)
                  Fetch API leaks memory in Chrome(Fetch API 在 Chrome 中泄漏内存)
                  How can I download and save a file using the Fetch API? (Node.js)(如何使用 Fetch API 下载和保存文件?(Node.js))
                  Send blob data to node using fetch, multer, express(使用 fetch、multer、express 将 blob 数据发送到节点)
                  Sending a custom User-Agent string along with my headers (fetch)(发送自定义用户代理字符串以及我的标头(获取))
                1. <i id='debmn'><tr id='debmn'><dt id='debmn'><q id='debmn'><span id='debmn'><b id='debmn'><form id='debmn'><ins id='debmn'></ins><ul id='debmn'></ul><sub id='debmn'></sub></form><legend id='debmn'></legend><bdo id='debmn'><pre id='debmn'><center id='debmn'></center></pre></bdo></b><th id='debmn'></th></span></q></dt></tr></i><div id='debmn'><tfoot id='debmn'></tfoot><dl id='debmn'><fieldset id='debmn'></fieldset></dl></div>

                    <tfoot id='debmn'></tfoot>
                      <bdo id='debmn'></bdo><ul id='debmn'></ul>

                          <tbody id='debmn'></tbody>

                          1. <small id='debmn'></small><noframes id='debmn'>

                            <legend id='debmn'><style id='debmn'><dir id='debmn'><q id='debmn'></q></dir></style></legend>