How to stop vertical scrolling of page when horizontal scroll slider?

Good afternoon.
Visit several product sliders, used slick-slider. But the swipe on mobile had somehow greatly inhibited.
So it is implemented like this:
var xCoordStart,
 xSlideTrigger = 50,
 slickElement = $('.slider'),

 slickElement.each(function(index, sliderItem){
 $(sliderItem).bind('touchstart', function (e){
 xCoordStart = e.originalEvent.touches[0].clientX;
 yCoordStart = e.originalEvent.touches[0].clientY;

 $(sliderItem).bind('touchend', function (e){
 var xCoordEnd = e.originalEvent.changedTouches[0].clientX;
 var yCoordEnd = e.originalEvent.changedTouches[0].clientY;

 var deltaX = Math.abs(xCoordEnd - xCoordStart)
 var deltaY = Math.abs(yCoordEnd - yCoordStart)
 console.log('x -' + deltaX)
 console.log('y' + deltaY)

 if(deltaX > deltaY){ // prevent slide while scrolling vertically
 if(xCoordStart > xCoordEnd + xSlideTrigger){
 else if(xCoordStart < xCoordEnd + xSlideTrigger){


Please tell me how to stop vertical scrolling of the entire page when the slider scrolls?
April 4th 20 at 13:18
0 answer

Find more questions by tags JavaScriptjQuery