@bchteam/scroll-converter

Converts vertical scrolling to horizontal.

Usage no npm install needed!

<script type="module">
  import bchteamScrollConverter from 'https://cdn.skypack.dev/@bchteam/scroll-converter';
</script>

README

@bchteam/scroll-converter

This script converts vertical scrolling to horizontal scrolling without any dependencies.

How it works

The methods from the package sets listener for mouse wheel scrolling the chosen element and updates the element's scrollLeft based on some calculations. Scrolling speed and step are not exactly the same as native scrolling's ones, but is good enough.

Usage

Install package

npm i -S @bchteam/scroll-converter

Import method

import scrollConverter from '@bchteam/scroll-converter'

Activate converting for element

const el = document.querySelector('.element-with-horizontal-scrolling')

scrollConverter.enable(el)

It can be deactivated also

scrollConverter.disable(el)