Login With Github

Swiper API: Keyboard And Mousewheel Control

Keyboard Control

Keyboard Control Parameters

Parameter Type Default Description
keyboard object/boolean false

Enables navigation through slides using keyboard. Object with keyboard parameters or boolean true to enable with default settings. For example:

var mySwiper = new Swiper('.swiper-container', {
  keyboard: {
    enabled: true,
    onlyInViewport: false,
  },
});

 

{
enabled boolean false Set to true to enable keyboard control
onlyInViewport boolean true When enabled it will control sliders that are currently in viewport
}

Keyboard Methods & Properties

Properties
mySwiper.keyboard.enabled Whether the keyboard control is enabled
Methods
mySwiper.keyboard.enable(); Enable keyboard control
mySwiper.keyboard.disable(); Disable keyboard control

Mousewheel Control

Mousewheel Control Parameters

Parameter Type Default Description
mousewheel object/boolean false

Enables navigation through slides using mouse wheel. Object with mousewheel parameters or boolean true to enable with default settings. For example:

var mySwiper = new Swiper('.swiper-container', {
  mousewheel: {
    invert: true,
  },
});

 

{
forceToAxis boolean false Set to true to force mousewheel swipes to axis. So in horizontal mode mousewheel will work only with horizontal mousewheel scrolling, and only with vertical scrolling in vertical mode.
releaseOnEdges boolean false Set to true and swiper will release mousewheel event and allow page scrolling when swiper is on edge positions (in the beginning or in the end)
invert boolean false Set to true to invert sliding direction
sensitivity number 1 Multiplier of mousewheel data, allows to tweak mouse wheel sensitivity
eventsTarged string / HTMLElement 'container' String with CSS selector or HTML element of the container accepting mousewheel events. By default it is swiper-container
}

Mousewheel Methods & Properties

Properties
mySwiper.mousewheel.enabled Whether the mousewheel control is enabled
Methods
mySwiper.mousewheel.enable(); Enable mousewheel control
mySwiper.mousewheel.disable(); Disable mousewheel control

0 Comment

temp