我遇到了同樣的問題,我希望在 div 中包含 sweetalert2 (不是 sweetalert toast),因為我希望除它之外的另一個 div 在彈出 sweetalert 時可以滾動。我已經嘗試過上面的代碼,但它仍然無法正常工作。var id = document.getElementById('mydiv');swal({title: "question",target: id,showConfirmButton: false,showCloseButton: true,allowOutsideClick: false,allowEscapeKey : false,customClass: "swal-height"});我也有固定的CSS定位#mydiv{? overflow: hidden;? height: calc(100% - 300px) !important;? padding-bottom: 70px;? position: relative !important;}#mydiv .swal-height {? ? position:absolute !important;? ? height: 720px !important;? ? width: 780px !important;? ? margin-left: 1100px !important;? ? margin-top: 280px !important;}你能建議我在這里做錯了什么嗎?這是 JSFiddle,它與我正在構建的類似: https:?//jsfiddle.net/0pt2vr87/7/感謝您的幫助。
div 內的 SweetAlert2
慕森卡
2023-07-20 16:06:10