簡體   English   中英

滾動后粘性頁腳不停留在底部

[英]sticky footer not staying at the bottom after I scroll

  • 我正在嘗試開發一個粘性頁腳。
  • 當您單擊“ 添加新運動”按鈕時,一個抽屜打開,該頁腳位於底部
  • 但是當我滾動頁面時,頁腳向上移動。
  • 我嘗試過擔任各種職位,但仍然無法正常工作。 你能告訴我如何解決它。 -在下面提供我的代碼段,沙箱和屏幕截圖。

在此處輸入圖片說明

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;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM