Socket
Socket
Sign inDemoInstall

swiper

Package Overview
Dependencies
0
Maintainers
1
Versions
324
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    swiper

Mobile touch slider and framework with hardware accelerated transitions


Version published
Weekly downloads
2.1M
decreased by-0.9%
Maintainers
1
Install size
280 kB
Created
Weekly downloads
 

Package description

What is swiper?

The swiper npm package is a modern touch slider with hardware accelerated transitions. It is intended for use in mobile websites, mobile web apps, and mobile native/hybrid apps. Swiper is designed to be used in a mobile environment, where touch interactions are fundamental. It provides a number of features like swiping, multiple slides per view, vertical slides, and more.

What are swiper's main functionalities?

Basic Swiper

This code initializes a basic Swiper instance with horizontal direction, loop mode, pagination, navigation arrows, and a scrollbar.

import Swiper from 'swiper';

const swiper = new Swiper('.swiper-container', {
  // Optional parameters
  direction: 'horizontal',
  loop: true,

  // If we need pagination
  pagination: {
    el: '.swiper-pagination',
  },

  // Navigation arrows
  navigation: {
    nextEl: '.swiper-button-next',
    prevEl: '.swiper-button-prev',
  },

  // And if we need scrollbar
  scrollbar: {
    el: '.swiper-scrollbar',
  },
});

Multiple Slides Per View

This code sets up a Swiper instance where you can have multiple slides visible at the same time, with space between the slides and clickable pagination.

import Swiper from 'swiper';

const swiper = new Swiper('.swiper-container', {
  slidesPerView: 3,
  spaceBetween: 30,
  pagination: {
    el: '.swiper-pagination',
    clickable: true,
  },
});

Vertical Swiper

This code snippet demonstrates how to initialize a Swiper instance that allows vertical swiping with clickable pagination.

import Swiper from 'swiper';

const swiper = new Swiper('.swiper-container', {
  direction: 'vertical',
  pagination: {
    el: '.swiper-pagination',
    clickable: true,
  },
});

Other packages similar to swiper

Readme

Source

Stories in Ready

Swiper - Mobile touch slider with hardware accelerated transitions

About

Swiper - is the free and ultra lightweight mobile touch slider with hardware accelerated transitions (where supported) and amazing native behavior. It is intended to use in mobile websites, mobile web apps, and mobile native apps. Designed mostly for iOS, but also works on Android and latest Desktop browsers. Swiper is created by iDangero.us

Features

  • 1:1 Touch movement. But this ratio can be configured

  • Touch emulation. This function will be useful if you are going to use Swiper on desktop sites. In this case Swiper will accept mouse events like touch events (click and drag to change slides)

  • Vertical/Horizontal. Swiper comes with 2 main modes - horizontal (for horizontal animation and horizontal swipes) and vertical (for vertical animation and vertical swipes)

  • Free Mode. When this mode enabled slides will not have fixed positions, like usual scroller (see demos bellow)

  • Rotation/resize adjustment. Swiper will be reinitialized after rotation of device

  • Responsive. Can be used with a width or/and height defined in percents, not fixed. Useful for usage on devices with a different resolutions

  • Scroll prevention. Swiper will prevent vertical scroll when you touch it in "horizontal" mode, and horizontal scroll in "vertical" mode

  • Resistant bounds. Swiper will increase resistance when you try to swipe it over than most left and most right positions (most top and most bottom for "vertical" mode)

  • Built-in pagination control. Can be disabled

  • Auto Play. Just set the delay and Swiper will change the slides automatically untill you touch it.

  • Loop mode. In this mode you will get infinite scrolling and first slides will repeat after last ones. New in 1.5

  • Carousel mode. Swiper allows you to set numbers of slides you want to display at the same time on slider's container. New in 1.5

  • Nested Swipers. You can insert one Swiper into slide of different Swiper, for example vertical into horizontal. New in 1.5

  • Any HTML. You can put any HTML content inside of slide, not only images

  • Rich API. Swiper comes with very rich API. It allows to create your own pagination, "next" and "previous" buttons and comes with 4 callbacks - onTouchStart, onTouchMove, onTouchEnd, onSlideSwitch

  • Flexible configuration. Swiper accepts a lot of parameters on initialization to make it much flexible as possible. You can configure animation speed, mode (vertical or horizontal), free mode, enable/disable pagination, touch ratio, etc.

  • Hardware accelerated. Swiper uses hardware accelerated technics (where supported) to achive ultra smooth animation and perfomance, especially on iOS devices.

  • Awesome compatibility. Swiper compatible and tested with: Mobile Safari (tested on iOS5), Android 2.1+, latest desktop versions of Google Chrome, Safari, Firefox, Internet Explorer 10 and Opera. It also works in Internet Explorer 9 but without animation.

  • Standalone. Swiper doesn't require any JavaScript libraries like jQuery, it makes Swiper much more smaller and faster. So it can be safely used with such libraries as jQuery, jQuery Mobile, jQTouch, etc.

  • Ultra lightweight. Only 3.2 KB minified and gzipped

With all these features you can build amazing touch interfaces and apps with awesome native behavior.

Demos & Usage

http://www.idangero.us/sliders/swiper/

License

Swiper is licensed under GPL & MIT

Keywords

FAQs

Last updated on 11 Feb 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc