React Scroll

React scroll 组件。(React scroll component.)

Github星跟蹤圖

React Scroll

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

Install

$ npm install react-scroll

Run

$ npm install
$ npm run examples

Examples

Checkout examples

Basic

Live
Or
Code

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" spy={true} smooth={true} offset={50} duration={500} >Test 1</Link>
		<Button className="btn" type="submit" value="Test 2" to="test2" spy={true} smooth={true} offset={50} duration={500} >Test 2</Button>

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

主要指標

概覽
名稱與所有者devfacet/natsboard
主編程語言JavaScript
編程語言JavaScript (語言數: 3)
平台
許可證MIT License
所有者活动
創建於2015-08-12 04:54:45
推送於2018-08-08 14:10:11
最后一次提交2017-09-13 22:48:05
發布數3
最新版本名稱v5.0.0 (發布於 2017-05-29 16:21:30)
第一版名稱v4.0.2 (發布於 2016-09-24 21:52:10)
用户参与
星數386
關注者數13
派生數60
提交數88
已啟用問題?
問題數17
打開的問題數11
拉請求數3
打開的拉請求數2
關閉的拉請求數2
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?