Skip to content

Instantly share code, notes, and snippets.

@daybrush
Created March 2, 2022 11:45
Show Gist options
  • Save daybrush/63a56217fed058c34d0b2b95141e6e3e to your computer and use it in GitHub Desktop.
Save daybrush/63a56217fed058c34d0b2b95141e6e3e to your computer and use it in GitHub Desktop.
import * as React from "react";
import { useConveyer } from "@egjs/react-conveyer";
export default function HorizontalScroll() {
const ref = React.useRef<HTMLDivElement>();
const {
isReachStart,
isReachEnd,
} = useConveyer(ref);
return <div className="examples">
<div className="buttons">
<button className="prev" disabled={isReachStart}>Start</button>
<button className="next" disabled={isReachEnd}>End</button>
</div>
<div className="items horizontal" ref={ref}>
<div className="item">1</div>
<div className="item">2</div>
<div className="item">3</div>
<div className="item">4</div>
<div className="item">5</div>
<div className="item">6</div>
<div className="item">7</div>
<div className="item">8</div>
<div className="item">9</div>
<div className="item">10</div>
</div>
</div>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment