Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.5k views
in Technique[技术] by (71.8m points)

el-popper 不能跟随页面滚动

一个项目中发现cascader的选择器dom el-popper 不能跟随页面滚动,
其内联样式absolute定位的top不跟随页面滚动。
image.png

手上另一个项目的 el-popper是跟随页面滚动的,对比了一下前端框架,也没有发现问题。

请问我应该怎么着手解决这个问题?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

绝对定位按父元素定位.
之前可以跟随应该是放在了一个开启定位的的父元素下,所以可以跟随.

修改方案如下

  1. 将poper移到滚动部分下.(比如list在body中滚动,就移动到list下)
  2. 滚动部分开启定位.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...