我正在为模式和通知使用 react-modal
。
我想禁用模态上的叠加/背景效果。我浏览了 API,但看不到任何相关信息。
这是我设置的基本模式。 https://codesandbox.io/s/upbeat-ptolemy-g0pyb?file=/src/App.js
关于如何只显示没有背景的模式有什么建议吗?请注意,如果在模态框外单击,我希望能够关闭模态框。
最佳答案
您需要将覆盖选项添加到 customStyles,其中 alpha 为 0。 像这样
const customStyles = {
overlay: {
backgroundColor: "rgba(0, 0, 0, 0)"
},
content: {
top: "50%",
left: "50%",
right: "auto",
bottom: "auto",
marginRight: "-50%",
transform: "translate(-50%, -50%)"
}
};
https://stackoverflow.com/questions/62799426/
相关文章:
common-lisp - 如何在普通的 lisp 中创建一个位数组?
apache-spark - 我可以获取 Spark 读取的文件的元数据吗
android - CameraX - 在纵向模式下锁定 Activity 时仅旋转预览
postgresql - 使用实体中的默认值与 PostgreSQL hibernate
javascript - 如何使用 typescript 导出 Mongoose 模式?
amazon-web-services - terraform 可以复制 s3 存储桶的内容吗?
oracle - 基于字符和数字的 PL/SQL Regex 搜索