1.1.0 • Published 3 years ago

codemixia-react-swiper v1.1.0

Weekly downloads
6
License
ISC
Repository
github
Last release
3 years ago

codemixia-react-swiper

react swiper for smartphone and desktop

How to use

Install

npm install codemixia-react-swiper --save

Default Sample

import React from 'react';
import Swiper from 'codemixia-react-swiper';

export default class App extends React.Component {
  render() {
    return (
      <div
        style={{
          overflow: 'hidden', // required
          width: '100%',
          height: '500px', // required (fixed height)
        }}>
        <Swiper>
          <div style={{ height: '100%', backgroundColor: '#f00' }}>1</div>
          <div style={{ height: '100%', backgroundColor: '#0f0' }}>2</div>
          <div style={{ height: '100%', backgroundColor: '#00f' }}>3</div>
        </Swiper>
      </div>
    );
  }
}

Paginate Sample

import React from 'react';
import Swiper from 'codemixia-react-swiper';

export default class App extends React.Component {
  render() {
    return (
      <div
        style={{
          overflow: 'hidden', // required
          width: '100%',
          height: '500px', // required (fixed height)
          position: 'relative', // for paginate item position absolute
        }}>
        <Swiper isPaginate={true}>
          <div style={{ height: '100%', backgroundColor: '#f00' }}>1</div>
          <div style={{ height: '100%', backgroundColor: '#0f0' }}>2</div>
          <div style={{ height: '100%', backgroundColor: '#00f' }}>3</div>
        </Swiper>
      </div>
    );
  }
}
._codemixia_swiper_paginate {
  position: absolute;
  right: 0;
  bottom: 10px;
  left: 0;
  text-align: center;
}
._codemixia_swiper_paginate .item {
  display: inline-block;
  vertical-align: top;
  width: 5px;
  height: 5px;
  border-radius: 5px;
  margin: 0 2px;
  background-color: rgba(255, 255, 255, 0.5);
}
._codemixia_swiper_paginate .item.on {
  background-color: rgba(255, 255, 255, 1);
}

auto rolling Sample

import React from 'react';
import Swiper from 'codemixia-react-swiper';

export default class App extends React.Component {
  render() {
    return (
      <div
        style={{
          overflow: 'hidden', // required
          width: '100%',
          height: '500px', // required (fixed height)
        }}>
        <Swiper isAutoRolling={true} rollingSeconds={5}>
          <div style={{ height: '100%', backgroundColor: '#f00' }}>1</div>
          <div style={{ height: '100%', backgroundColor: '#0f0' }}>2</div>
          <div style={{ height: '100%', backgroundColor: '#00f' }}>3</div>
        </Swiper>
      </div>
    );
  }
}
1.1.0

3 years ago

1.0.0

3 years ago

0.0.9

3 years ago