gpt4 book ai didi

javascript - 滚动后粘性页脚不会停留在底部

转载 作者:太空宇宙 更新时间:2023-11-04 06:44:50 28 4
gpt4 key购买 nike

  • 我正在尝试开发一个粘性页脚。
  • 当您点击添加新运动按钮时,会打开一个抽屉,其中的页脚会保留在底部
  • 但是当我滚动页面时,页脚向上移动。
  • 我尝试过各种职位,但仍然没有工作。你能告诉我如何解决它吗?- 在下面提供我的代码片段、沙盒和屏幕截图。

enter image description here

https://codesandbox.io/s/jp82jl853v

 sportsEditTabContentFooter: {
position: "fixed",
left: 0,
bottom: 0,
width: "100 %",
backgroundColor: "red",
color: "white",
textAlign: "center"
},


<div className={classes.sportsEditTabContentFooter}>
<div>sports Status</div>
<div>
<Button variant="outlined" className={classes.button}>
Cancel
</Button>
<Button
variant="outlined"
onClick={this.savesports}
className={classes.button}
>
Save sports test
</Button>
</div>
</div>

最佳答案

查看您的代码后,您似乎没有将 position:sticky 应用到 div。如果您添加它,您应该注意到它会粘在您放置它的位置。

.RecipeReviewCard-sportsEditTabContentFooter-649 {
left: 0;
width: 100%;
color: white;
bottom: 0;
text-align: center;
background-color: red;
position: sticky;
}

关于javascript - 滚动后粘性页脚不会停留在底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53402011/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com