Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Implements

Implemented by

Index

Constructors

constructor

  • new default(container: any, options?: any): default
  • Constructs a new Swiper instance.

    Parameters

    • container: any

      Where Swiper applies to.

    • Optional options: any

      Instance options.

    Returns default

Properties

a11y

a11y: any

activeIndex

activeIndex: number

Index number of currently active slide

note

Note, that in loop mode active index value will be always shifted on a number of looped slides

allowSlideNext

allowSlideNext: boolean

Disable / enable ability to slide to the next slides by assigning false / true to this property

allowSlidePrev

allowSlidePrev: boolean

Disable / enable ability to slide to the previous slides by assigning false / true to this property

allowTouchMove

allowTouchMove: boolean

Disable / enable ability move slider by grabbing it with mouse or by touching it with finger (on touch screens) by assigning false / true to this property

animating

animating: boolean

true if swiper is in transition

autoplay

autoplay: any

cardsEffect

cardsEffect: any

clickedIndex

clickedIndex: number

Index number of last clicked slide

clickedSlide

clickedSlide: HTMLElement

Link to last clicked slide (HTMLElement)

controller

controller: any

coverflowEffect

coverflowEffect: any

creativeEffect

creativeEffect: any

cubeEffect

cubeEffect: any

currentBreakpoint

currentBreakpoint: any

!INTERNAL

destroyed

destroyed: boolean

!INTERNAL

el

el: HTMLElement

Slider container HTML element

fadeEffect

fadeEffect: any

flipEffect

flipEffect: any

freeMode

freeMode: any

hashNavigation

hashNavigation: any

height

height: number

Height of container

history

history: any

isBeginning

isBeginning: boolean

true if slider on most "left"/"top" position

isEnd

isEnd: boolean

true if slider on most "right"/"bottom" position

isLocked

isLocked: boolean

true if slide is "locked" (by watchOverflow) and slides can not be, e.g. when amount of slides is less that slides per view

keyboard

keyboard: any

loopedSlides

loopedSlides: null | number

!INTERNAL

modules

modules: any[]

!INTERNAL

mousewheel

mousewheel: any

navigation

navigation: any

originalParams

originalParams: any

Object with original initialization parameters

pagination

pagination: any

parallax

parallax: any

params

params: any

Object with passed initialization parameters

previousIndex

previousIndex: number

Index number of previously active slide

progress

progress: number

Current progress of wrapper translate (from 0 to 1)

realIndex

realIndex: number

Index number of currently active slide considering rearranged slides in loop mode

rtlTranslate

rtlTranslate: boolean

!INTERNAL

scrollbar

scrollbar: any

slides

slides: HTMLElement[]

Array of slides HTML elements. To get specific slide HTMLElement use swiper.slides[1]

slidesEl

slidesEl: HTMLElement

Wrapper HTML element

slidesGrid

slidesGrid: number[]

Slides grid

slidesSizesGrid

slidesSizesGrid: number[]

Array of widths for slides

snapGrid

snapGrid: number[]

Slides snap grid

snapIndex

snapIndex: number

Index number of current snap in snapGrid

swipeDirection

swipeDirection: "prev" | "next"

Direction of sliding

thumbs

thumbs: any

touches

touches: { currentX: number; currentY: number; diff: number; startX: number; startY: number }

Object with the following touch event properties:

  • swiper.touches.startX
  • swiper.touches.startY
  • swiper.touches.currentX
  • swiper.touches.currentY
  • swiper.touches.diff

Type declaration

  • currentX: number
  • currentY: number
  • diff: number
  • startX: number
  • startY: number

translate

translate: number

Current value of wrapper translate

virtual

virtual: any

width

width: number

Width of container

wrapperEl

wrapperEl: HTMLElement

Wrapper HTML element

zoom

zoom: any

Static defaults

defaults: any

Swiper default options

Static extendedDefaults

extendedDefaults: any

Object with global Swiper extended options

Methods

attachEvents

  • attachEvents(): void
  • Attach all events listeners again

    Returns void

changeDirection

  • changeDirection(direction?: "horizontal" | "vertical", needUpdate?: boolean): void
  • Changes slider direction from horizontal to vertical and back.

    Parameters

    • Optional direction: "horizontal" | "vertical"

      New direction. If not specified, then will automatically changed to opposite direction

    • Optional needUpdate: boolean

      Will call swiper.update(). Default true

    Returns void

changeLanguageDirection

  • changeLanguageDirection(direction: "rtl" | "ltr"): void
  • Changes slider language

    Parameters

    • direction: "rtl" | "ltr"

      New direction. Should be rtl or ltr

    Returns void

destroy

  • destroy(deleteInstance?: boolean, cleanStyles?: boolean): void
  • Destroy slider instance and detach all events listeners

    Parameters

    • Optional deleteInstance: boolean

      Set it to false (by default it is true) to not to delete Swiper instance

    • Optional cleanStyles: boolean

      Set it to true (by default it is true) and all custom styles will be removed from slides, wrapper and container. Useful if you need to destroy Swiper and to init again with new options or in different direction

    Returns void

detachEvents

  • detachEvents(): void
  • Detach all events listeners

    Returns void

disable

  • disable(): void
  • Disable Swiper (if it was enabled). When Swiper is disabled, it will hide all navigation elements and won't respond to any events and interactions

    Returns void

emit

  • emit<E>(event: E, ...args: any[]): void
  • Fire event on instance

    Type parameters

    • E: string | number | symbol

    Parameters

    • event: E
    • Rest ...args: any[]

    Returns void

enable

  • enable(): void
  • Enable Swiper (if it was disabled)

    Returns void

getBreakpoint

  • getBreakpoint(breakpoints: any): string
  • !INTERNAL

    Parameters

    • breakpoints: any

    Returns string

getTranslate

  • getTranslate(): any
  • Get current value of swiper wrapper css3 transform translate

    Returns any

init

  • Initialize slider

    Parameters

    • Optional el: HTMLElement

    Returns default

isHorizontal

  • isHorizontal(): boolean
  • !INTERNAL

    Returns boolean

loopCreate

  • loopCreate(): void
  • !INTERNAL

    Returns void

loopDestroy

  • loopDestroy(): void
  • !INTERNAL

    Returns void

maxTranslate

  • maxTranslate(): number
  • Get current maximal translate value

    Returns number

minTranslate

  • minTranslate(): number
  • Get current minimal translate value

    Returns number

off

  • off<E>(event: E, handler: any): void
  • off<E>(event: E): void
  • Remove event handler

    Type parameters

    • E: string | number | symbol

    Parameters

    • event: E
    • handler: any

    Returns void

  • Remove all handlers for specified event

    Type parameters

    • E: string | number | symbol

    Parameters

    • event: E

    Returns void

offAny

  • offAny(handler: (eventName: string, ...args: any[]) => void): void
  • Remove event listener that will be fired on all events

    Parameters

    • handler: (eventName: string, ...args: any[]) => void
        • (eventName: string, ...args: any[]): void
        • Parameters

          • eventName: string
          • Rest ...args: any[]

          Returns void

    Returns void

on

  • on<E>(event: E, handler: any): void
  • Add event handler

    Type parameters

    • E: string | number | symbol

    Parameters

    • event: E
    • handler: any

    Returns void

onAny

  • onAny(handler: (eventName: string, ...args: any[]) => void): void
  • Add event listener that will be fired on all events

    Parameters

    • handler: (eventName: string, ...args: any[]) => void
        • (eventName: string, ...args: any[]): void
        • Parameters

          • eventName: string
          • Rest ...args: any[]

          Returns void

    Returns void

once

  • once<E>(event: E, handler: any): void
  • Add event handler that will be removed after it was fired

    Type parameters

    • E: string | number | symbol

    Parameters

    • event: E
    • handler: any

    Returns void

setBreakpoint

  • setBreakpoint(): void
  • !INTERNAL

    Returns void

setGrabCursor

  • setGrabCursor(): void
  • Set grab cursor

    Returns void

setProgress

  • setProgress(progress: number, speed?: number): void
  • Set Swiper translate progress (from 0 to 1). Where 0 - its initial position (offset) on first slide, and 1 - its maximum position (offset) on last slide

    Parameters

    • progress: number

      Swiper translate progress (from 0 to 1).

    • Optional speed: number

      Transition duration (in ms).

    Returns void

setTranslate

  • setTranslate(translate: any): void
  • Set custom css3 transform's translate value for swiper wrapper

    Parameters

    • translate: any

    Returns void

slideNext

  • slideNext(speed?: number, runCallbacks?: boolean): boolean
  • Run transition to next slide.

    Parameters

    • Optional speed: number

      Transition duration (in ms).

    • Optional runCallbacks: boolean

      Set it to false (by default it is true) and transition will not produce transition events.

    Returns boolean

slidePrev

  • slidePrev(speed?: number, runCallbacks?: boolean): boolean
  • Run transition to previous slide.

    Parameters

    • Optional speed: number

      Transition duration (in ms).

    • Optional runCallbacks: boolean

      Set it to false (by default it is true) and transition will not produce transition events.

    Returns boolean

slideReset

  • slideReset(speed?: number, runCallbacks?: boolean): boolean
  • Reset swiper position to currently active slide for the duration equal to 'speed' parameter.

    Parameters

    • Optional speed: number

      Transition duration (in ms).

    • Optional runCallbacks: boolean

      Set it to false (by default it is true) and transition will not produce transition events.

    Returns boolean

slideTo

  • slideTo(index: number, speed?: number, runCallbacks?: boolean): boolean
  • Run transition to the slide with index number equal to 'index' parameter for the duration equal to 'speed' parameter.

    Parameters

    • index: number

      Index number of slide.

    • Optional speed: number

      Transition duration (in ms).

    • Optional runCallbacks: boolean

      Set it to false (by default it is true) and transition will not produce transition events.

    Returns boolean

slideToClosest

  • slideToClosest(speed?: number, runCallbacks?: boolean): boolean
  • Reset swiper position to closest slide/snap point for the duration equal to 'speed' parameter.

    Parameters

    • Optional speed: number

      Transition duration (in ms).

    • Optional runCallbacks: boolean

      Set it to false (by default it is true) and transition will not produce transition events.

    Returns boolean

slideToLoop

  • slideToLoop(index: number, speed?: number, runCallbacks?: boolean): default
  • Does the same as .slideTo but for the case when used with enabled loop. So this method will slide to slides with realIndex matching to passed index

    Parameters

    • index: number

      Index number of slide.

    • Optional speed: number

      Transition duration (in ms).

    • Optional runCallbacks: boolean

      Set it to false (by default it is true) and transition will not produce transition events.

    Returns default

slidesPerViewDynamic

  • slidesPerViewDynamic(): number
  • Get dynamically calculated amount of slides per view, useful only when slidesPerView set to auto

    Returns number

translateTo

  • translateTo(translate: number, speed: number, runCallbacks?: boolean, translateBounds?: boolean): any
  • Animate custom css3 transform's translate value for swiper wrapper

    Parameters

    • translate: number

      Translate value (in px)

    • speed: number

      Transition duration (in ms)

    • Optional runCallbacks: boolean

      Set it to false (by default it is true) and transition will not produce transition events

    • Optional translateBounds: boolean

      Set it to false (by default it is true) and transition value can extend beyond min and max translate

    Returns any

unsetGrabCursor

  • unsetGrabCursor(): void
  • Unset grab cursor

    Returns void

update

  • update(): void
  • You should call it after you add/remove slides manually, or after you hide/show it, or do any custom DOM modifications with Swiper This method also includes subcall of the following methods which you can use separately:

    Returns void

updateAutoHeight

  • updateAutoHeight(speed?: number): void
  • Force swiper to update its height (when autoHeight enabled) for the duration equal to 'speed' parameter

    Parameters

    • Optional speed: number

      Transition duration (in ms).

    Returns void

updateProgress

  • updateProgress(): void
  • recalculate swiper progress

    Returns void

updateSize

  • updateSize(): void
  • recalculate size of swiper container

    Returns void

updateSlides

  • updateSlides(): void
  • recalculate number of slides and their offsets. Useful after you add/remove slides with JavaScript

    Returns void

updateSlidesClasses

  • updateSlidesClasses(): void
  • update active/prev/next classes on slides and bullets

    Returns void

Static extendDefaults

  • extendDefaults(options: any): void
  • Extend global Swiper defaults

    Parameters

    • options: any

    Returns void

Static use

  • use(modules: any[]): void
  • Installs modules on Swiper in runtime.

    Parameters

    • modules: any[]

    Returns void

Generated using TypeDoc