1.1.1 • Published 7 years ago
react-carousel-mobile v1.1.1
react-carousel-mobile
react carousel image javascript mobile
See source: https://github.com/ShiHaoLin/react-carousel-mobile.git
See demo: https://shihaolin.github.io/react-carousel-mobile/test/index.html
##1. Install the package
npm install react-carousel-mobile --save
##2. Import component
With ES2015:
import Carousel from 'react-carousel-mobile';
With ES5:
var Carousel = require('react-carousel-mobile');
##3. Import (or copy) CSS files 路径根据自己项目目录修改;拷贝node_modules/react-carousel-mobile/lib/carousel.css 文件到对应目录下引用 ,建议拷贝出来,node_modules下文件可能会跳过webpack编译。
With ES2015:
import './carousel.css'
With ES5:
require('./carousel.css')
##4. Example Example usageES6:
import React from 'react'
import Carousel from 'react-carousel-mobile'
import './carousel.css'// 根据自己目录环境修改
render(
(<Carousel autoPlay={true} intervalTime={2000} durationTime={200} >
<div>
<a href="#">
<img src='./images/1.jpg' width="100%"/>
</a>
</div>
<div>
<a href="#">
<img src='./images/2.jpg' width="100%"/>
</a>
</div>
<div>
<a href="#">
<img src='./images/3.jpg' width="100%"/>
</a>
</div>
<div>
<a href="#">
<img src='./images/4.jpg' width="100%"/>
</a>
</div>
</Carousel>),
document.getElementById('root')
)