Javascript - Smooth parallax scrolling with mouse wheel

后端 未结 5 1029
轻奢々
轻奢々 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

    This plugin for Chrome provides the functionality necessary for this. Someone created a gist with a minified version of it. It's from a pretty old version, but I think that's fine because, as I've checked, the latest version of the plugin adds too much stuff.

    A couple things with that gist though:

    • It checks if the browser is Chrome before initiating.
    • It initiates automatically.
    • It uses jQuery.

    So I let myself create a version that addresses those points. Just add the script and call SmoothScroll.init() to start.

提交回复
热议问题