Closed haveamission closed 1 year ago
It can be done using the scrollItem
method.
Check the demo: https://react-glider.vercel.app/#ref_exposes_glider
const gliderRef = React.useRef < GliderMethods > null;
return (
<button
type="button"
onClick={() => {
const random = Math.floor(Math.random() * 12);
gliderRef.current?.scrollItem(random);
}}
>
Scroll to random item
</button>
);
Perfect, worked great, thank you!
Is it possible to have an external event that lets a user go to a specific slide?
Something like the parent library's:
scrollTo
function