Skip to content

Commit

Permalink
New "onlyInViewport" parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Jan 13, 2018
1 parent 070c3e9 commit f0da8ce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/keyboard/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Keyboard = {
if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {
return undefined;
}
if (kc === 37 || kc === 39 || kc === 38 || kc === 40) {
if (swiper.params.keyboard.onlyInViewport && (kc === 37 || kc === 39 || kc === 38 || kc === 40)) {
let inView = false;
// Check that swiper should be inside of visible area of window
if (swiper.$el.parents(`.${swiper.params.slideClass}`).length > 0 && swiper.$el.parents(`.${swiper.params.slideActiveClass}`).length === 0) {
Expand Down Expand Up @@ -90,6 +90,7 @@ export default {
params: {
keyboard: {
enabled: false,
onlyInViewport: true,
},
},
create() {
Expand Down

0 comments on commit f0da8ce

Please sign in to comment.