Skip to content

Instantly share code, notes, and snippets.

@dinizgb
Created April 6, 2022 20:18
Show Gist options
  • Save dinizgb/e997ae2a6747a3e3ee51baa2d5fa870e to your computer and use it in GitHub Desktop.
Save dinizgb/e997ae2a6747a3e3ee51baa2d5fa870e to your computer and use it in GitHub Desktop.
React Indiana Drag Scroll Default Usage
import React, { Component } from 'react';
import styled from 'styled-components';
import ScrollContainer from 'react-indiana-drag-scroll';
const MenuSticky = styled.div`
width: 100%;
padding: 10px 0;
display: -moz-box;
display: -webkit-box;
top: 0;
`;
export default function Index() {
return (
<>
<ScrollContainer component={MenuSticky}> //If you are not using Styled Components you can replace the 'component' with 'className="YOUR_CSS_CLASS"'
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</ScrollContainer>
</>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment