sweetalert 2 target a div rather than entire window?

前端 未结 1 1547
星月不相逢
星月不相逢 2021-01-25 14:28

Is it possible to target a div rather than the entire window for SweetAlert2?

If not is is possible to edit the center coordinates?

The reason I ask is that I ha

相关标签:
1条回答
  • 2021-01-25 14:40

    Here you go:

    Swal.fire({
      title: 'I will be placed inside the #swal2-container',
      target: document.getElementById('swal2-container')
    })
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
    
    <div id="swal2-container"></div>

    SweetAlert2 documentation: https://sweetalert2.github.io/

    0 讨论(0)
提交回复
热议问题