如何使用类似于 Chart.io 和 simple.com 的 smoothscroll 窗格创建动画菜单
我正在尝试创建一个 1 页网站,顶部有一个与 Chart.io 或 simple.com 类似风格的菜单,有人能给我指点一个好的教程吗?我已经使用谷歌进行了搜索,但我还没有找到任何可以实现我想要做的事情的东西。
我目前使用 Mootools 平滑滚动进行滚动,但是我在为菜单项下的元素设置动画时遇到问题。
非常感谢任何和所有的帮助......
I'm trying to create a 1 page website that has a menu across the top in a similar style to chart.io or simple.com, can anyone point me in the direction of a good tutorial? I've searched using google but I've not managed to come up with anything that does something like what I'm trying to do.
I currently have Mootools smooth scroll doing the scroll however I'm having trouble animating the element under the menu item.
Any and all help is greatly appreciated...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
开始使用 CSS 固定标题菜单:
然后你可以使用像这样的 Mootools 插件:
正如你所看到的,使用这个插件你可以轻松获取滚动位置,这样你就可以将菜单下的三角形放置在正确的位置。
要为三角形设置动画,您只需要一些基本的补间动画。 HTML 将会是这样的:
CSS:
Mootools
tween
用于动画,这会将三角形从当前位置平滑地移动到左侧 300px:希望这会对您有所帮助!
Start making the header menu fixed using CSS:
Then you can use a Mootools plugin like this one:
As you can see, with this plugin you can easily get the scroll position, so you can place the triangle under the menu in the correct position.
To animate the triangle, you just need some basic
tween
animation. HTML will be something like this:CSS:
Mootools
tween
for animation, this will move the triangle smoothly from it's current position to 300px from the left:Hope this will help you!