如何在向下滚动时缩小导航菜单?
对于我正在开发的新网站,我希望在用户向下滚动时缩小导航菜单。
类似于您在 IBM 站点上看到的内容: http://www.ibm.com/us/ en/
我找不到任何 jQuery 实现或教程(我确信我一定是搜索了错误的关键字),
所以如果有人能给我指出正确的方向,那会让我非常高兴。
提前致谢!
For a new site I am developing I would love to shrink the navigation menu when the user scrolls down.
Something similar to what you can see at the IBM site: http://www.ibm.com/us/en/
I couldn't find any jQuery implementation or tutorial around (I am sure I must be searching the wrong keywords)
So if someone can point me in the right direction it will make me really happy.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
给你,
演示:http://jsfiddle.net/seancannon/npdqa9ua/
Here you go man:
Demo: http://jsfiddle.net/seancannon/npdqa9ua/
您要做的就是检查窗口的滚动值。如果它大于零,则用户已向下滚动。如果是这样,则隐藏横幅(或缩小或其他方式)。如果他们回到顶部然后重新显示它。
http://jsfiddle.net/rxXkE/
});
What you do is check the scroll value of the window. If it is greater than zero then the user has scrolled down. If so then hide the banner (or shrink or whatever). If they go back to the top then reshow it.
http://jsfiddle.net/rxXkE/
});
当用户滚动时,导航栏会收缩和增大。在 http://www.kriesi.at/themes/enfold/ 导航栏创建此内容。我创建的版本几乎相同。 https://github.com/Jlshulman/Elastic-Bar
This shrinks and grows the navigation bar as the user scrolls. Created this off of http://www.kriesi.at/themes/enfold/ navigation bar. The version i created works nearly the same. https://github.com/Jlshulman/Elastic-Bar