Giter Site home page Giter Site logo

swiper's Introduction

Swiper

I rewrite thebird's swipe by React, so this is a React component of mobile swipe. Here is thebird's swipe: https://github.com/thebird/Swipe

demo

Here is URL: https://yinguangyao.github.io/swiper/build/

run

npm install
npm start

Usage

<Swiper>
	<img src="" alt="" style={{width: "100%"}} />
	<img src="" alt="" style={{width: "100%"}} />
	<img src="" alt="" style={{width: "100%"}} />
</Swiper>

You must use a few styles like this:

* {
    margin: 0;
    padding: 0;
}
.swiper {
    width: 100%;
    overflow: hidden;
    position: relative;
    .swiper-wrap {
        zoom: 1;
        &::after{
            content: "";
            display: table;
            clear: both;
            height: 0;
        }
        img, div {
            position: relative;
            float: left;
            height: 180px;
            width: 100%;
        }
        img {
            max-width: 100%;
        }
    }
    .swiper-dot {
        position: absolute;
        bottom: 10px;
        z-index: 100px;
        left: 42%;  
        margin: 0 auto;
        text-align: center;
        span {
            border-radius: 50%;
            background-color: white;
            border: 1px solid gray;
            width: 10px;
            height: 10px;
            margin-right: 8px;
            float: left;
        }
        .cur {
            background-color: gray;
        }
    }
}

notice: classname must be these.

Props

  • startSlide Integer (default:0) - index position Swipe should start at

  • speed Integer (default:300) - speed of prev and next transitions in milliseconds.

  • auto Integer - begin with auto slideshow (time in milliseconds between slides)

  • continuous Boolean (default:true) - create an infinite feel with no endpoints

  • disableScroll Boolean (default:false) - stop any touches on this container from scrolling the page

  • callback Function - runs at slide change.

  • transitionEnd Function - runs at the end slide transition.

swiper's People

Contributors

yinguangyao avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.