@visual-framework/vf-smooth-scroll

1.0.0-alpha.3 • Public • Published

Smooth scroll utility component

npm version

About

This enables smooth scrolling when a user clicks on anchor links or other in-page scrolling is triggered.

Usage

This is an opt-in behaviour that is activated by putting the vf-smooth-scroll class on a parent element — a good place would be at <html class="vf-smooth-scroll"> (note: it probably won't work if you add it your <body> element).

Note that as of Safari version 15.4 (released March 2022), CSS-based smooth scrolling is supported by Safari on Mac OS or iOS.

Accessibility

This component targets WCAG 2.1 AA accessibility.

Generally this improves accessibility by smooth scrolling between content, for some scenarios the behaviour may become distracting.

Note that smooth scrolling is disabled if a user has flagged prefers-reduced-motion.

You can also read about the Visual Framework's approach to accessibility.

Install

This repository is distributed with [npm][https://www.npmjs.com/]. After [installing npm][https://www.npmjs.com/get-npm] and yarn, you can install vf-smooth-scroll with this command.

$ yarn add --dev @visual-framework/vf-smooth-scroll

Sass/CSS

The style files included are written in Sass. If you're using a VF-core project, you can import it like this:

@import "@visual-framework/vf-smooth-scroll/vf-smooth-scroll.scss";

Make sure you import Sass requirements along with the modules. You can use a project boilerplate or the vf-sass-starter

Help

Readme

Keywords

Package Sidebar

Install

npm i @visual-framework/vf-smooth-scroll

Weekly Downloads

0

Version

1.0.0-alpha.3

License

Apache 2.0

Unpacked Size

26.5 kB

Total Files

13

Last publish

Collaborators

  • bhushan-ebi
  • pacope92
  • ebiwebdev
  • sandykadam
  • khawkins98