0.0.1 • Published 4 years ago

@zhangmmm/react-onepage v0.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

react-onepage

本库可用于快速创建单页滚动(全屏滚动)效果组件,并提供可配置动画效果及相关钩子

用法

安装

npm install @zhangmmm/react-onepage --save

例子

import React from 'react';
import { render } from 'react-dom';
import OnePage from '@zhangmmm/react-onepage';

const App = () => (
  <OnePage>
    <div style={{ height: '100vh', backgroundColor: 'green' }}></div>
    <div style={{ height: '100vh', backgroundColor: 'red' }}></div>
    <div style={{ height: '100vh', backgroundColor: 'blue' }}></div>
    <div style={{ height: '100vh', backgroundColor: 'yellow' }}></div>
  </OnePage>
);

render(<App />, document.getElementById('root'));

API

属性说明类型默认值
speed过渡动画速度(ms)Number1500
animation过渡动画类型Stringease
delay过渡动画延迟时间(ms)Number0
onTransitionEnd过渡动画结束回调Function-