react-sticky-el和材质ui网格:滚动时,粘性元素跳到底部

时间:2020-09-18 09:41:36

标签: javascript css reactjs material-ui

我正在尝试将react-scroll-el元素放置在材料ui网格中。

<Grid item xs={5} style={{height:"100%"}} 
   className="scroll-parent-for-heading">
      <Sticky mode="top" boundaryElement=".scroll-parent-for-heading">
         <section>
            <Typography variant="h1" className={classes.sectionHeading}>
               {title}
            </Typography>
         </section>
      </Sticky>        
</Grid>

问题在于,一旦触发了粘性特性,元素就会跳到底部,而不是随滚动移动。

我可以看到这样的样式

transform: translateZ(0px); width: 578.469px; position: absolute; height: 100%; bottom: 0px;

您认为我该怎么办?是因为高度设置为100%?该算法是否不使用 “计算值”还是“使用值”?

我不打算为粘性组件使用特定的库,但是我不能放弃material-ui。

所有替代方案都欢迎。

0 个答案:

没有答案