# postcss-momentum-scrolling

> PostCSS plugin for adding 'momentum' style scrolling behavior (-webkit-overflow-scrolling: touch) for elements with overflow (scroll, auto) on iOS

Latest version **3.14.22** (published 2021-08-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-momentum-scrolling
pnpm add postcss-momentum-scrolling
yarn add postcss-momentum-scrolling
bun add postcss-momentum-scrolling
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.14.22 |
| Published | 2021-08-20 |
| First published | 2017-10-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.0.0 |
| Dependencies | 0 |
| Unpacked size | 13.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 70 |
| Author | yunusga |
| Maintainers | yunusga |
| Keywords | postcss, css, postcss-plugin, momentum-scrolling, scroll, ios-safari, ios, safari |

## Links

- npm: https://www.npmjs.com/package/postcss-momentum-scrolling
- Repository: https://github.com/solversgroup/postcss-momentum-scrolling
- Homepage: https://github.com/solversgroup/postcss-momentum-scrolling#postcss-momentum-scrolling
- Issues: https://github.com/solversgroup/postcss-momentum-scrolling/issues
- npm.io page: https://npm.io/package/postcss-momentum-scrolling

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 3.14.22 (latest) — 2021-08-20
- 3.13.22 — 2021-06-10
- 3.12.21 — 2021-05-18
- 3.11.20 — 2021-05-04
- 3.10.19 — 2021-04-12
- 3.9.17 — 2021-03-31
- 3.8.16 — 2021-03-05
- 3.7.15 — 2021-02-11
- 3.6.15 — 2021-02-07
- 3.5.15 — 2021-01-18
- 3.4.13 — 2021-01-08
- 3.3.12 — 2020-12-31
- 3.2.12 — 2020-12-29
- 3.2.10 — 2020-12-09
- 3.1.9 — 2020-12-07
- … 36 more at https://npm.io/package/postcss-momentum-scrolling/versions

## README

# PostCSS Momentum Scrolling

[PostCSS]:          https://github.com/postcss/postcss
[ci-img]:           https://travis-ci.org/solversgroup/postcss-momentum-scrolling.svg
[ci]:               https://travis-ci.org/solversgroup/postcss-momentum-scrolling
[MIT]:              https://github.com/solversgroup/postcss-momentum-scrolling/blob/master/LICENSE
[official docs]:    https://github.com/postcss/postcss#usage
[Releases history]: https://github.com/solversgroup/postcss-momentum-scrolling/blob/master/CHANGELOG.md

[![npm](https://img.shields.io/npm/v/postcss-momentum-scrolling.svg)](https://www.npmjs.com/package/postcss-momentum-scrolling) [![Build Status][ci-img]][ci]
[![npm](https://img.shields.io/npm/dt/postcss-momentum-scrolling.svg)](https://www.npmjs.com/package/postcss-momentum-scrolling)

[PostCSS] plugin for adding **momentum** style scrolling behavior (`-webkit-overflow-scrolling:touch`) for elements with overflow (scroll, auto) on iOS.

## Example

```css
/* Input example */
.minicart {
  overflow: scroll;
}
```

```css
/* Output example */
.minicart {
  overflow: scroll;
  -webkit-overflow-scrolling: touch;
}
```

## Live Example

![With and without -webkit-overflow-scrolling: touch](https://yunusga.github.io/img/postcss-momentum-scrolling.gif)

[Live demo](https://dev.solvers.group/momentum/), [YouTube demo](https://www.youtube.com/watch?v=mYLSv7Il-D0)

### 🔗 Links:

 - [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-overflow-scrolling)
 - [Momentum Scrolling on iOS Overflow Elements](https://css-tricks.com/snippets/css/momentum-scrolling-on-ios-overflow-elements/)
 - [Six things I learnt about iOS Safari's rubber band scrolling](https://www.specialagentsqueaky.com/blog-post/ssy5i7qw/2015-06-10-six-things-i-learnt-about-ios-rubberband-overflow-scrolling/)

## Getting Started

First thing's, install the module:

```
npm install postcss-momentum-scrolling --save-dev
```

## 🍳 Usage

Check you project for existed PostCSS config: `postcss.config.js`
in the project root, `"postcss"` section in `package.json`
or `postcss` in bundle config.

If you already use PostCSS, add the plugin to plugins list:

```diff
module.exports = {
  plugins: [
+   require('postcss-momentum-scrolling')([
+     // example options
+     'hidden',
+     'scroll',
+     'auto',
+     'inherit'
+   ]),
    require('autoprefixer')
  ]
}
```

If you do not use PostCSS, add it according to [official docs]
and set this plugin in settings.

## 🍰 Options

> If the passed options are not an `Array`, then the default options will be set.

`Array` of `overflow` property values at which you want to add momentum style scrolling behavior. Default `['hidden', 'scroll', 'auto', 'inherit']` (use only `['scroll']` for minimize css size).

### Custom options example

```js
postcss([
  require('postcss-momentum-scrolling')([
    'hidden',
    'inherit'
  ])
])
```

```css
/* Before */
header {
  overflow: hidden;
}

main {
  overflow: scroll;
}

footer {
  overflow: inherit;
}
```

```css
/* After */
header {
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
}

main {
  overflow: scroll;
}

footer {
  overflow: inherit;
  -webkit-overflow-scrolling: touch;
}
```

## Changelog

See [Releases history]

## License

[MIT]

## Other PostCSS plugins

- [`postcss-sort-media-queries`](https://github.com/yunusga/postcss-sort-media-queries) - plugin for combine and sort CSS media queries with **mobile first** or **desktop first** methods

---
_Source: https://npm.io/package/postcss-momentum-scrolling · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
