javascript - 如何使用react-modal显示没有背景效果的模态?
问题描述
我正在使用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%)"
}
};
推荐阅读
- linux - 需要建议在 linux 中移动一个大的实时文件
- c# - 使用 C# 将 Excel 转换为 CSV,在每一行上获得额外的
- python - 在下面的代码中立即执行方法后的 Tkinter
- transparent - mikrotik 上的 mitmproxy 透明代理不起作用
- javascript - vue.js 中用于电话号码的正则表达式
- android - 无法从 android 应用程序的 webview 检查元素
- java - Java 在另一个类对象上同步
- observable - 打印 Observable 对象
- php - 在 WHM 的 CPANEL EASY APACHE 4 中安装 PHP 5.2
- c++ - 如何在 pqxx7 中使用动态参数执行 sql