WhileTruu/elm-smooth-scroll/1.0.0

NOTE: the latest version is 1.0.1

SmoothScroll

Scrolling to position that always takes the same amount of time.

type Config

Configuration for smooth scrolling.

createConfig : Easing -> Int -> Config

Create a smooth scroll configuration from an easing function and a duration in milliseconds.

  • easing: Easing functions specify the rate of change of a parameter over time.

  • duration: The total duration of the scroll in milliseconds.

createConfig Ease.outCubic 100
scrollTo : Config -> Float -> Task x ()

Scroll to the y offset of the browser viewport using the easing function and duration specified in the config.

scrollTo (createConfig Ease.outCubic 100) 500