Javascript - Smooth parallax scrolling with mouse wheel

后端 未结 5 1019
轻奢々
轻奢々 2020-12-08 05:38

I have a page where I\'m applying a parallax effect. This is accomplished using translate3d. Now, while this works well, I\'m wondering how I can override the default \"step

5条回答
  •  庸人自扰
    2020-12-08 06:09

    Great question.

    The library I use is this one: https://github.com/cferdinandi/smooth-scroll

    Simply include the smoothscroll.js file, and job done. The mouse-wheel will now smoothly easy down the page, rather than jumping down in chunks of pixels.

    It really improves the look of parallax webpages.

    Btw, for parallax images, I use this library:

    https://github.com/pederan/Parallax-ImageScroll

    It's really easy to add to a webpage, just remember to include and initialise this library at the bottom of your webpage, after your images and HTML.

    (I didn't realise that this would make a difference, but it absolutely does !)

提交回复
热议问题