【问题标题】:Getting an aria-haspopup showing显示 aria-haspopup
【发布时间】:2019-05-08 09:49:14
【问题描述】:

我有一个 Shopify 网站,我想借一些代码来弹出一个非常好的条款和条件、政策等。它在结帐页面上,这就是代码的样子...

<td nowrap class="tg-8jgo"><a aria-haspopup="dialog" href="/6007783493/policies/7893516357.html" data-close-text="Close" data-title-text="Terms of service" data-modal="policy-7893516357">Terms of service</a></td>

This 是一个链接到它工作的页面(退款等在底部),但是当我把它放到不同的页面上时,我无法让它工作。

我查看了可能引用它的代码的其他部分,但找不到与之链接的任何内容(即弹出窗口),我查看了附加到页面的 js 文件,可以什么都找不到。 在 www 上也找不到任何东西,因为它似乎都将 aria 代码用于菜单而不是弹出窗口。

它将条款和条件显示为页面上的一个框架,并使背景变灰/模糊。然后可以简单地使用 ESC 或关闭按钮关闭窗口。

【问题讨论】:

    标签: html wai-aria


    【解决方案1】:

    由于您无法提供任何代码,而且我不太明白您想告诉我们的内容,因此我建议您使用引导模式。 您只需单击 X 或模态框外的任何位置即可将其关闭。背景像你想要的那样模糊。

    编辑:您可以将 modal-lg 添加到 modal-dialog 并使其更大。检查此链接以获取有关如何使用模态的更多信息: https://getbootstrap.com/docs/4.0/components/modal/

    如果您想真正自定义模态大小,请查看此链接: Modal width (increase)

    $(document).ready(function() {
      $('#myModal').modal('show');
    });
    body.modal-open .supreme-container {
      -webkit-filter: blur(1px);
      -moz-filter: blur(1px);
      -o-filter: blur(1px);
      -ms-filter: blur(1px);
      filter: blur(1px);
    }
    
    .modal-lg {
        max-width: 100% !important;
    }
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
    
    
    <div class="supreme-container">Page content
    
    </div>
    <div id="myModal" class="modal modal-lg" tabindex="-1" role="dialog">
      <div class="modal-dialog modal-lg" style="width: 800px" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title">Modal title</h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
          </div>
          <div class="modal-body">
            <p>TERMS OF SERVICE HERE</p>
          </div>
        </div>
      </div>
    </div>

    【讨论】:

    • 嗨,对不起。我已经粘贴了代码,不确定那里发生了什么,但这是代码... 退款政策
    • 这部分显示他们也使用模态:data-moda。测试我的代码,看看这是否是所需的输出。
    • 效果很好,谢谢!花了我一段时间,但设法获得从其他文件导入 html 的代码,但似乎无法更改对话框的大小?尝试在您设置的代码以及样式和 css 中进行设置,但无法覆盖大部分屏幕(例如大约 90% 高和 90% 宽)。我敢肯定这很容易!
    • 你是个传奇,谢谢!仅仅是因为你重命名了班级吗?我尝试添加这样的样式,但没有奏效。不需要 %?
    • 终于搞定了... $.get(strURL, function(data) { html=data; document.getElementById('modal-body').innerHTML = html; });工作一种享受!
    猜你喜欢
    • 1970-01-01
    • 2013-12-21
    • 2021-12-18
    • 2021-08-18
    • 1970-01-01
    • 1970-01-01
    • 2022-06-20
    • 2013-11-06
    • 1970-01-01
    相关资源
    最近更新 更多