sag1v/react-elastic-carousel
关于
A flexible and responsive carousel component for react https://sag1v.github.io/react-elastic-carousel
网站与应用开发可以做什么
- RTL (right-to-left) supportSupporting right-to-left languages requires a full support for right-to-left rendering and animations which is not supported in most of the carousel components out there. also, right-to-left support is important and should be a standard for most applications.
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文react-elastic-carousel
A flexible and responsive carousel component for react
Why do we need yet another carousel component
Element resize support (true responsiveness)
Most of the carousel components are responsive to the viewport size, but this is not a real responsive support as we can have an element with awidth:500pxon a1200pxscreen, most carousel component will "think" we are on a1200pxmode because they "watch" the view-port's size and not the wrapping element's size. This is the reason whyreact-eleastic-carouselis using the resize-observer which gives us a true responsive support, not matter on what screen size we are.RTL (right-to-left) support
Supporting right-to-left languages requires a full support for right-to-left rendering and animations which is not supported in most of the carousel components out there. also, right-to-left support is important and should be a standard for most applications.
Live Demos & Docs
Install
npm install --save react-elastic-carousel
or
yarn add react-elastic-carousel
Note
react-elastic-carousel is using styled-components for styling, this means that you should install it as well:
npm install --save styled-components
Usage
import React, { Component } from 'react';
import Carousel from 'react-elastic-carousel';
class App extends Component {
state = {
items: [
{id: 1, title: 'item #1'},
{id: 2, title: 'item #2'},
{id: 3, title: 'item #3'},
{id: 4, title: 'item #4'},
{id: 5, title: 'item #5'}
]
}
render () {
const { items } = this.state;
return (
<Carousel>
{items.map(item => <div key={item.id}>{item.title}</div>)}
</Carousel>
)
}
}
Playground
Development
git clone https://github.com/sag1v/react-elastic-carousel.git
cd react-elastic-carousel
yarn
To run the docs site run
yarn start
to run a demo Application run
yarn demo
The application is running at http://localhost:8888
License
MIT © sag1v
探索相关项目
加载中…