• Stars
    star
    212
  • Rank 186,122 (Top 4 %)
  • Language
    JavaScript
  • Created over 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ–± πŸ”› Scroll horizontally with the mouse wheel!

React Scroll Horizontal

Scroll horizontally with the mousewheel!

NPM

demo

npm install --save react-scroll-horizontal

How it Works

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>


Usage

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 a lock__ 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

Arbitrary Parent/Child Widths Example

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>
    )
  }
}

Full Width Example

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>

    )
  }
}

Roadmap

  • Normalize mouse delta values (see: #1)
  • Implement tests ✨
  • Perf optimizations
  • Ability to swap out animation engines (maybe)

Contributing

Want to help out? Great!

Sites/Apps using React Scroll Horizontal

ieaseMusic


MIT Β© hew

More Repositories

1

bazaar

🀹 Build x-platform React apps bizarrely fast.
JavaScript
52
star
2

paprika

πŸ₯„ A Gatsby starter for people who need forms but hate servers.
JavaScript
19
star
3

reason-styled-system

An approximate styled-system API in reasonml
ReScript
16
star
4

materialize-landing-page

πŸ›¬ A landing page built with the Materialize framework.
CSS
16
star
5

styled-functors

Reason React Native UI Primatives
OCaml
12
star
6

react-image-compare

πŸ›€ Low-level React components for picture comparisons
JavaScript
11
star
7

choo-webpack

πŸ“¦ Choo + Webpack. Deal with it.
JavaScript
10
star
8

react-hummus

πŸ‘… A tasty React starter
JavaScript
8
star
9

hew.tools

☁️ Personal Site
JavaScript
8
star
10

bs-react-native-next-hooks

Bucklescript 5. React Hooks. With React Native.
OCaml
7
star
11

xstate-react-global-context-example

Quick example for the gang
JavaScript
7
star
12

reasonable-website

πŸ”Ί Reasonml website boilerplate.
OCaml
4
star
13

hotfiles

πŸ”₯ vim, git, fish, tmux, hyper, kitty, etc
Lua
4
star
14

react-static-landing-page

πŸ’² Generate static HTML. Use jQuery or whatever.
JavaScript
3
star
15

theme-ui-native

JavaScript
2
star
16

fresh-resume-theme

My resume theme
HTML
2
star
17

wrench

JavaScript
2
star
18

jsforce-connect

➑️ A small helper for dealing with Jsforce connections.
JavaScript
2
star
19

rust-landing-page

A marketing-style landing page written in Rust
Rust
2
star
20

_min

πŸ“ [WIP] A rapid styling system built on Hyperapp.
JavaScript
2
star
21

resume

My (fresh) resume
2
star
22

snips

βœ‚οΈ Snip! Compatible with Code + Vim
2
star
23

rust-hackerrank-solutions

Rust
2
star
24

cardamom

JavaScript
2
star
25

sqlite-react-todo-app

JavaScript
2
star
26

landing-page-express

πŸ›¬ Form validation + Email.
JavaScript
2
star
27

gatsby-theme-ui-starter

theme-ui, styled system, Netlify Forms
JavaScript
2
star
28

reason-express-static

A quick demonstration of the Bucklescript Bindings for Express
OCaml
1
star
29

supreme

Supreme
Objective-C
1
star
30

deno-test

Begin app
TypeScript
1
star
31

foundry-test

Solidity
1
star
32

resume.css

πŸ’…πŸ½ Styling my professional self
CSS
1
star
33

wp-hacking-mobx

πŸ‘Ύ A MobX-powered Wordpress Theme [WIP]
JavaScript
1
star
34

reason-snippets

βœ‚οΈ Snip! Compatible with Code + Vim
1
star
35

space-css

πŸ‘½ Atomic classes for the final frontier.
CSS
1
star
36

keystone-postgres-error-reproduced

JavaScript
1
star
37

near-generative-website

CSS
1
star
38

seed-repo-fetch

Rust
1
star
39

metadata-fetcher

TypeScript
1
star
40

crossbreed-native

Swift
1
star
41

crossbreed-web

Crossbreed allows you to search the parent genetics of flowers.
JavaScript
1
star
42

gitdenza

TypeScript
1
star
43

nice-certs-swiftui

Swift
1
star
44

react-delivery-app-exercise_matt-jones

JavaScript
1
star