A react module for full page scroll
npm install --save react-full-page-scroller
import React, { Component } from 'react'
import MyComponent from 'react-full-page-scroller'
import 'react-full-page-scroller/dist/index.css'
class Example extends Component {
render() {
return (
<MyComponent>
<div>
<h1>1</h1>
</div>
<div>
<h1>2</h1>
</div>
<div>
<h1>3</h1>
</div>
</MyComponent>
)
}
}
Prop Name | Type |
---|---|
pageNav | Object |
indicatorStyle | object |
indicatorStyleActive | object |
You can customize every button in the nav page
Name | Type | Required | Description |
---|---|---|---|
id | number | Yes | id for the object. |
title | string | Yes | title of the nav button. |
className | string | No | the className of the page nav button. |
style | object | No | A custom style for the page nav button. |
import React, { Component } from 'react'
import MyComponent from 'react-full-page-scroller'
import 'react-full-page-scroller/dist/index.css'
const PageNavExample {
const navExample={[{
id: 1,
title: 'title 1',
className: 'page-nav-button',
style: { width: '1rem' }
},
{
id: 2,
title: 'title 2',
className: 'page-nav-button',
style: { width: '1rem' }
},
{
id: 3,
title: 'title 3',
className: 'page-nav-button',
style: { width: '1rem' }
}
]};
return (
<MyComponent pageNav={navExample}>
<div>
<h1 className='page-number'>1</h1>
</div>
<div>
<h1 className='page-number'>2</h1>
</div>
<div>
<h1 className='page-number'>3</h1>
</div>
</MyComponent>
)
}
You can add an indicator by adding the two props indicatorStyle and indicatorStyleActive
Name | Type | Required | Description |
---|---|---|---|
indicatorStyle | object | Yes | the indicator default style is required to show the indicator. |
indicatorStyleActive | object | No | the style of the active indicator. |
import React, { Component } from 'react'
import MyComponent from 'react-full-page-scroller'
import 'react-full-page-scroller/dist/index.css'
const PageNavExample {
const indicatorStyle = {
height: '8px',
width: '8px',
margin: '10px',
borderRadius: '4px',
backgroundColor: 'white',
transition: 'width 500ms ease'
}
const indicatorStyleActive= { width: '20px' }
return (
<MyComponent indicatorStyle={indicatorStyle} indicatorStyleActive={indicatorStyleActive}>
<div>
<h1 className='page-number'>1</h1>
</div>
<div>
<h1 className='page-number'>2</h1>
</div>
<div>
<h1 className='page-number'>3</h1>
</div>
</MyComponent>
)
}
react-full-page-scroller's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.