react-scroll-horizontal 1.6.5
Install from the command line:
Learn more about npm packages
$ npm install @oplab-team/react-scroll-horizontal@1.6.5
Install via package.json:
"@oplab-team/react-scroll-horizontal": "1.6.5"
About this version
Scroll horizontally with the mousewheel!
npm install --save react-scroll-horizontal
Feed <HorizontalScroll>
one child, or many children.
So long as they have a static width, this component will
take care of the rest. Note: the width of the children must
be greater than the width of the <HorizontalScroll>
npm i react-scroll-horizontal
<HorizontalScroll
pageLock = { bool }
reverseScroll = { bool }
style = { object }
config = {{ stiffness: int, damping: int }}
className = { string }
animValues = { int }
>
{ children }
</HorizontalScroll>
Props
-
pageLock
- Adds alock__
class to the HTML body -
reverseScroll
- Reverses the scroll direction -
style
- Pass a style object through to parent div -
config
- Passes a spring config object to React Motion -
className
- Classnames to pass into the component -
animValues
- Emulate scroll by passing a delta value
Gotchas
- Child item(s) must be px/em/vw - no percentages (yet)
- Flexbox weirdness in IE
import React, { Component } from 'react'
import HorizontalScroll from 'react-scroll-horizontal'
class ScrollingHorizontally extends Component {
render() {
const child = { width: `30em`, height: `100%`}
const parent = { width: `60em`, height: `100%`}
return (
<div style={parent}>
<HorizontalScroll>
<div style={child} />
<div style={child} />
<div style={child} />
</HorizontalScroll>
</div>
)
}
}
import React, { Component } from 'react'
import HorizontalScroll from 'react-scroll-horizontal'
class ScrollingHorizontally extends Component {
render() {
const child = { width: `300em`, height: `100%`}
return (
<body>
<HorizontalScroll>
<div style={child} />
</HorizontalScroll>
</body>
)
}
}
- Normalize mouse delta values (see: #1)
- Implement tests ✨
- Perf optimizations
- Ability to swap out animation engines (maybe)
Want to help out? Great!
MIT © hew
Details
- react-scroll-horizontal
- oplab-team
- about 3 years ago
- MIT
- 32 dependencies
Assets
- react-scroll-horizontal-1.6.5-npm.tgz
Download activity
- Total downloads 4,147
- Last 30 days 0
- Last week 0
- Today 0