Socket
Book a DemoInstallSign in
Socket

github.com/fisshy/react-scroll

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/fisshy/react-scroll

Source
Go
Version
v0.0.2
Version published
Created
Source

React Scroll

Directive for basic scrolling and smooth scrolling ( work in progress ) Feel free to contribute - everything is appreciated

Install

$ I've not uploaded it to npm yet, I want to finish it first.

Run

$ npm install
$ npm run examples

Examples

Checkout examples

basic

Usage


var React = require('react');
var Scroll = require('react-scroll'); 

var Link = Scroll.Link;
var Element = Scroll.Element;

var Section = React.createClass({
  render: function () {
  	return (
		<Link to="test1" smooth={true}>Test 1</Link>
		<Link to="test2" smooth={true}>Test 2</Link>

		<Element name="test1" className="element">
		  test 1
		</Element>

		<Element name="test2" className="element">
		  test 2
		</Element>
	);
  }
});

React.render(
  <Section />,
  document.getElementById('example')
);

Create your own Link/Element

Simply just include the mixins!

var React = require('react');
var Scroll = require('react-scroll'); 
var Helpers = Scroll.Helpers;

var Element = React.createClass({
  mixins: [Helpers.Element],
  render: function () {
    return (
      <div>
        {this.props.children}
      </div>
    );
  }
});

var Link = React.createClass({
  mixins: [Helpers.Scroll],
  render: function () {
    return (
      <a onClick={this.onClick} href="test">
        {this.props.children}
      </a>
    );
  }
});

Todo

  • Vertical scrolling
  • Scroll to element
  • Smooth scroll animation
  • Live examples
  • Pass scroll/animation duration as settings
  • Horizontal scrolling
  • Spy on scrolling/Highlight
  • Write test

FAQs

Package last updated on 03 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts