gpt4 book ai didi

jquery - 需要帮助在滚动条上制作粘性导航栏 - 在 nodejs/express 中使用 jade 和手写笔

转载 作者:搜寻专家 更新时间:2023-10-31 08:54:36 26 4
gpt4 key购买 nike

这是我正文部分的代码:

header.main-header
h1 Reshared
p This site is still under construction.
nav.main-nav
ul
li
a(href="#") About
li
a(href="#") Services
li
a(href="#") Contact
.main
h2 This is a Column
p This is a test

这是 main.styl 文件中的代码。我还想添加一张图片,但网站现在的样子,但我现在不能,因为我需要 10 个声誉点。

@import 'nib'

global-reset()

*
box-sizing border-box

body
font-size 16px
font-family arial, sans-serif

.main-header
background #f07057
height 100vh
position fixed
width 100%
top 0
text-align center
color #f7f7f7
display flex
align-items center
justify-content center
flex-direction column

h1
font-size 2em

body
padding-top calc(100vh - 5em)

.main-nav
background #f7f7f7
height 80px
z-index 50
border-bottom #f07057 5px solid
text-align center
display flex
align-items center
justify-content center

li
display inline

a
text-decoration none
color #111
font-family arial, sans-serif
padding 20px
font-size 20px

.main-nav, .main
position relative
.main
background #f2f2e8

根据我所拥有的,我如何让我的导航粘性盎司让用户滚动过去。

这是该网站的图片: This is what the site looks like.

这是用户向下滚动时发生的情况。我希望导航栏在经过它时坚持到顶部。 Scrolling the site down

最佳答案

只需将 static: top 添加到导航栏就可以了。然后,您应该在主页面上添加一个上边距,这样导航栏下就不会隐藏任何内容。

关于jquery - 需要帮助在滚动条上制作粘性导航栏 - 在 nodejs/express 中使用 jade 和手写笔,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29735160/

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