<tfoot id='dB2Yk'></tfoot>

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

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

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

        如何关闭新的html&lt;对话框&gt;通过单击其

        时间:2023-09-04

              <bdo id='CDH1p'></bdo><ul id='CDH1p'></ul>
              <legend id='CDH1p'><style id='CDH1p'><dir id='CDH1p'><q id='CDH1p'></q></dir></style></legend>
                <tbody id='CDH1p'></tbody>
              <tfoot id='CDH1p'></tfoot>

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

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

                • 本文介绍了如何关闭新的html&lt;对话框&gt;通过单击其 ::backdrop 标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我没有找到任何内置的解决方案或解决方法来通过单击其背景 (::backdrop) 来关闭 html5 元素,尽管它显然是一个基本功能.

                  I didn't find any built in solution or workaround for closing the html5 element by clicking on its background(::backdrop), although it's clearly a basic functionality.

                  推荐答案

                  可以使用对话框边界矩形检测背景点击.

                  Backdrop clicks can be detected using the dialog bounding rect.

                  var dialog = document.getElementByTagName('dialog');
                  dialog.showModal();
                  dialog.addEventListener('click', function (event) {
                      var rect = dialog.getBoundingClientRect();
                      var isInDialog=(rect.top <= event.clientY && event.clientY <= rect.top + rect.height
                        && rect.left <= event.clientX && event.clientX <= rect.left + rect.width);
                      if (!isInDialog) {
                          dialog.close();
                      }
                  });
                  

                  这篇关于如何关闭新的html&lt;对话框&gt;通过单击其 ::backdrop 标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:多个输入框 - alertifyjs/Jquery 下一篇:简单&amp;小的纯javascript灯箱(对话框覆盖)?

                  相关文章

                  最新文章

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

                      <legend id='AVxzf'><style id='AVxzf'><dir id='AVxzf'><q id='AVxzf'></q></dir></style></legend>
                    1. <small id='AVxzf'></small><noframes id='AVxzf'>

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