react-fullpage
made with
React
简介及使用教程
react-fullpage是一个基于React的全屏滚动组件,是fullpage.js的React官方封装。通过fullpage.js,你可以轻松的创建全屏滚动页面。
安装
Npm
npm install @fullpage/react-fullpage
Yarn
yarn add @fullpage/react-fullpage
使用
import React from 'react';
import ReactDOM from 'react-dom';
import ReactFullpage from '@fullpage/react-fullpage';
const Fullpage = () => (
<ReactFullpage
//fullpage options
licenseKey = {'YOUR_KEY_HERE'}
scrollingSpeed = {1000} /* Options here */
render={({ state, fullpageApi }) => {
return (
<ReactFullpage.Wrapper>
<div className="section">
<p>Section 1 (welcome to fullpage.js)</p>
<button onClick={() => fullpageApi.moveSectionDown()}>
Click me to move down
</button>
</div>
<div className="section">
<p>Section 2</p>
</div>
</ReactFullpage.Wrapper>
);
}}
/>
);
ReactDOM.render(<Fullpage />, document.getElementById('react-root'));
示例
作者
Álvaro Trigo
@imac2相关项目