我正在使用 Bootstrap 3,并希望在用户滚动经过我的大标题图像时实现 这种效果页.我需要导航栏的背景从透明变为白色.我查看了他们的代码,我知道它是用 javascript 完成的,甚至看到了 WHERE 我认为它发生了(在那个 JS 中查找 ID '#main-header')...
I'm using Bootstrap 3 and want to achieve this effect when the user scrolls past the large header image on my page. I need the background of the navbar to go from transparent to white. I looked in their code and I KNOW it is done with javascript, and even saw WHERE it was happening I think (look for the ID '#main-header' in that JS)...
除了不了解高级 Javascript 之外,我正在寻找一种在滚动超过某个点时将其应用于导航栏的方法.我的代码的类称为导航栏",我希望它在通过#main"时变成白色.如果您需要更多信息,请告诉我,如果有人想提供帮助,请提前致谢!
Not knowing advanced Javascript aside, I'm looking for a way to apply this to my navigation bar when scrolling past a certain point. The class for my code is called 'navbar' and I would like it to turn white when it passes "#main". Let me know if you need more information, and thanks in advance if anyone wants to help!
如果你使用 Twitter Bootstrap,这可以通过'Affix' 插件
If you're using Twitter Bootstrap this can be achieved with the 'Affix' plugin
设置起来非常简单,这里是文档
这篇关于滚动经过锚点时,如何使导航栏更改 CSS 类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
discord.js v12:我如何等待 DM 频道中的消息?discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 频道中的消息?)
如何让我的机器人提及发出该机器人命令的人how to make my bot mention the person who gave that bot command(如何让我的机器人提及发出该机器人命令的人)
如何修复必须使用导入来加载 ES 模块 discord.jsHow to fix Must use import to load ES Module discord.js(如何修复必须使用导入来加载 ES 模块 discord.js)
如何列出来自特定服务器的所有成员?How to list all members from a specific server?(如何列出来自特定服务器的所有成员?)
Discord bot:修复“找不到 FFMPEG"Discord bot: Fix ‘FFMPEG not found’(Discord bot:修复“找不到 FFMPEG)
使用 discord.js 加入 discord 服务器时的欢迎消息Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服务器时的欢迎消息)