简体   繁体   English

在屏幕上居中 window.confirm 对话框

[英]centering a window.confirm dialog box on the screen

I have the following dialog box that is working correctly, however, I can't get it to center on the page:我有以下对话框可以正常工作,但是,我无法让它在页面上居中:

<Button variant="danger" onClick={() => { if (window.confirm('Delete character?')) handleCharacterDeletion(row.original) }}>DELETE</Button>

The box appears on the top of the page, but I want it centered in the middle.该框出现在页面顶部,但我希望它位于中间。

I tried wrapping the whole thing in a tag, but that actaully didn't do one little thing.我尝试将整个东西包装在一个标签中,但实际上并没有做任何一件小事。

Is there way to get my dialog centered?有没有办法让我的对话居中?

Thank you谢谢

It's not possible to center a Window interface (ex: window.alert, window.confirm...) because it's native to your web-browser.无法将Window接口(例如:window.alert、window.confirm...)居中,因为它是您的网络浏览器的原生接口。

However, you can make a modal with libraries ( Micromodal , Fancybox ) or from scratch.但是,您可以使用库( MicromodalFancybox )或从头开始制作模式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM