Skip to content

Commit

Permalink
Merge pull request #437 from panec/master
Browse files Browse the repository at this point in the history
Check if event is cancelable before calling preventDefault - PR from mac9416 with latest master
  • Loading branch information
ganlanyuan authored Sep 6, 2019
2 parents e4372ef + 890b232 commit bdfcc63
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/tiny-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -2538,7 +2538,9 @@ export var tns = function(options) {
if (moveDirectionExpected) { preventScroll = true; }
}

if (preventScroll) { e.preventDefault(); }
if ((typeof e.cancelable !== 'boolean' || e.cancelable) && preventScroll) {
e.preventDefault();
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/tiny-slider.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -2538,7 +2538,9 @@ export var tns = function(options) {
if (moveDirectionExpected) { preventScroll = true; }
}

if (preventScroll) { e.preventDefault(); }
if ((typeof e.cancelable !== 'boolean' || e.cancelable) && preventScroll) {
e.preventDefault();
}
}
}

Expand Down

0 comments on commit bdfcc63

Please sign in to comment.