<tfoot id='vxFdE'></tfoot>

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

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

    2. 通过单击远离它来关闭模式弹出窗口

      时间:2023-06-21
          <bdo id='bSBIM'></bdo><ul id='bSBIM'></ul>
        • <i id='bSBIM'><tr id='bSBIM'><dt id='bSBIM'><q id='bSBIM'><span id='bSBIM'><b id='bSBIM'><form id='bSBIM'><ins id='bSBIM'></ins><ul id='bSBIM'></ul><sub id='bSBIM'></sub></form><legend id='bSBIM'></legend><bdo id='bSBIM'><pre id='bSBIM'><center id='bSBIM'></center></pre></bdo></b><th id='bSBIM'></th></span></q></dt></tr></i><div id='bSBIM'><tfoot id='bSBIM'></tfoot><dl id='bSBIM'><fieldset id='bSBIM'></fieldset></dl></div>
          <tfoot id='bSBIM'></tfoot>
        • <legend id='bSBIM'><style id='bSBIM'><dir id='bSBIM'><q id='bSBIM'></q></dir></style></legend>

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

            <tbody id='bSBIM'></tbody>

                本文介绍了通过单击远离它来关闭模式弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用本教程添加模态屏幕:

                I am using this tutorial to add a modal screen:

                http://raventools.com/blog/create-a-modal-dialog-using-css-and-javascript/

                一切都很好,除了关闭它.我不想通过按钮关闭它,而是让用户选择通过单击模式外部来关闭它,即在它后面的页面其余部分的背景中.

                Everything works great except closing it. Rather than closing it via a button, I want to give the user the option to close it by clicking outside of the modal, i.e. in the background of the rest of the page behind it.

                一位用户告诉我像这样将 onclick='overlay()' 添加到覆盖 div <div id="overlay" onclick='overlay()'>

                A user told me to add onclick='overlay()' to the overlay div like this <div id="overlay" onclick='overlay()'>

                当我尝试通过在外部单击来关闭模式时,它可以工作,但如果您单击实际模式本身,它也会关闭,我不想要它,因为它是一个注册表单.那么有没有办法只通过在实际模态本身之外单击来关闭模态?

                When I try to close the modal by clicking outside if it, it works, but it also closes if you click on the actual modal itself, which I don't want as it is a registration form. So is there any way to only close the modal by clicking outside of the actual modal itself?

                推荐答案

                试试这个:

                $(document).ready(function(){
                $('#overlay').bind('click', function(event){
                    if (event.target == $('#overlay').get(0))
                        overlay(); 
                });
                

                这篇关于通过单击远离它来关闭模式弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

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

                    1. <tfoot id='fzSgb'></tfoot>
                        <bdo id='fzSgb'></bdo><ul id='fzSgb'></ul>
                          <tbody id='fzSgb'></tbody>