P粉9860280392023-09-01 18:38:39
Although it may not place the button exactly where you want, you can always set the dialog box's borders and background to be transparent. Then inside there is a div that you set to look like a dialog box. and place the button inside the dialog itself. This will make the button appear to be outside the dialog box, but still allow you to access it. You'll need to mess with size and absolute positioning, though.
const favDialog = document.querySelector('.modal-post'); const showButton = document.querySelector('#showButton'); const nextButton = document.querySelector('.next-modal-button'); showButton.addEventListener('click', () => { favDialog.showModal(); }); nextButton.addEventListener('click', () => { console.log("NEXT"); });
.modal-post { border:0; background:transparent; height:100% } .next-modal-button { position: absolute; width: 60px; height: 30px; color: black; bottom: 20px; right: 10px; z-index: 1000; } .modal-body{ background:#fff; border:1px solid #000; padding:10px; width: 500px; height: 280px; }
<dialog class="modal-post" ref="postModalRef"> <div class="modal-body">Modal screen</div> <button class="next-modal-button" @click="displayNextModal">Next</button> </dialog> <button id="showButton">Show</button>