如何根据鼠标或元素定位模态?

问题描述

我制作了一个反应项目,您可以在其中在 API 中搜索电影标题。它返回与您的搜索相对应的所有电影并显示一个列表。到目前为止一切顺利。

每个列表元素都有一个按钮,可以打开带有扩展信息的模式。我的问题是造型。如果我向下滚动列表并点击一部电影,它的模式会在页面顶部打开。

如何根据鼠标或按钮元素的位置让每个模态打开?

这是我目前的样式:

.modal {
  display: flex;
  width: 100%;
  height: 100vh;
  justify-content: space-around;
  align-items: center;
  background-color: rgba(0,0.753);
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
}

.inner-modal {
  text-align: left;
  background-color: rgb(255,255,255);
  color: black;
  width: 70%;
  height: auto;
  padding: 40px;
}

.modal-poster {
  float: right;
  width: 30%;
  padding: 20px 0px 20px 30px;
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)