简体   繁体   English

使用 CSS 或 Javascript 平滑滚动效果

[英]Smooth scrolling effect using CSS or Javascript

I have seen many websites using smooth scrolling ( click here to see an example).我见过许多使用平滑滚动的网站(单击此处查看示例)。 So, my question is that how they achieve this effect, do they use some libraries, etc. I have searched for this but didn't find the right answer.所以,我的问题是他们是如何实现这种效果的,他们是否使用了一些库等。我已经搜索过这个但没有找到正确的答案。

您可以尝试使用https://github.com/ivmello/easeScroll这个 jquery 这将帮助您在鼠标滚轮上平滑滚动,但对于其他 appering 动画,您必须使用一些动画库,如gsap

The effect you are looking for is called Parallax.您正在寻找的效果称为视差。 Do a search for "multi layer parallax websites".搜索“多层视差网站”。 There was a good how-to with code high up the first page.有一个很好的操作方法,代码位于第一页的高处。

Edit: The second part of the example website is the Hero image (the banners) zooming, you can get that searching "Hero image zooming"编辑:示例网站的第二部分是英雄图像(横幅)缩放,您可以搜索“英雄图像缩放”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM