a simple master slave scroller
npm install react-master-slave-scrollMasterSlaveScroll is a React component allowing users to create a fixed side menu whcich is longer than the viewport and scrolls along with the main page in sync.
react-master-slave-scroll using npm (or [yarn]). npm install react-master-slave-scroll
react-master-slave-scroll to use MasterSlaveScroll, Master and Slave components.
jsx
import React from 'react';
import ReactDOM from 'react-dom';
import MasterSlaveScroll, {Master, Slave} from 'react-master-slave-scroll';
class App extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
slaveWidthPx={300}
>
top
bottom
);
}
}
ReactDOM.render(
,
document.getElementById('app')
);
`
API
$3
#### minWidthPx: number
Set min-width attribute to MasterSlaveScroll component.
#### slaveWidthPx: number, required
Set width` attribute to slave component.