sweetalert 2 目标 div 而不是整个 window?
sweetalert 2 target a div rather than entire window?
是否可以针对 SweetAlert2 定位 div 而不是整个 window?
如果没有可以编辑中心坐标吗?
我问的原因是我有几个 JavaScript 游戏想使用这个框架。这些加载在 <div>
中,不在页面中央。甜蜜的警报弹出窗口打开时看起来很奇怪,因为它未对齐。
这适用于手机游戏,但不适用于基于浏览器的游戏。
任何帮助都会很棒 :)
给你:
Swal.fire({
title: 'I will be placed inside the #swal2-container',
target: document.getElementById('swal2-container')
})
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<div id="swal2-container"></div>
SweetAlert2 文档:https://sweetalert2.github.io/
是否可以针对 SweetAlert2 定位 div 而不是整个 window?
如果没有可以编辑中心坐标吗?
我问的原因是我有几个 JavaScript 游戏想使用这个框架。这些加载在 <div>
中,不在页面中央。甜蜜的警报弹出窗口打开时看起来很奇怪,因为它未对齐。
这适用于手机游戏,但不适用于基于浏览器的游戏。
任何帮助都会很棒 :)
给你:
Swal.fire({
title: 'I will be placed inside the #swal2-container',
target: document.getElementById('swal2-container')
})
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<div id="swal2-container"></div>
SweetAlert2 文档:https://sweetalert2.github.io/