bxSlider touch enabled - disable vertical touch events so only horizontal touch events work

梦想的初衷 提交于 2019-12-07 02:32:18

问题


I'm using probably one of my favourite jquery slider plugins: bxSlider

http://bxslider.com/options#touchEnabled

Recently they've updated with some touch enabling for devices. This allows you to scroll your sliders via swiping.

But on my current project, I have a slideshow that takes up the entire width of my website, and when viewing on a device, as I scroll down with my finger, when I reach the the slideshow, I am unable to scroll down the page, and instead the slideshow scrolls left to right.

So my question is, is it possible to disable the vertical touch events so it only works when the scroll is swiped horizontally.

var winnerSlider = $('#slider').bxSlider({

});

I have a fiddle if anyone can help... http://jsfiddle.net/2Fcxw/10/

Scan qr below to view fiddle on device.

Thanks


回答1:


$('#slider').bxSlider({
touchEnabled:false
});

This should work.




回答2:


var winnerSlider = $('#slider').bxSlider({
    preventDefaultSwipeY: false
});

preventDefaultSwipeY should be exactly what you needed. http://bxslider.com/options#preventDefaultSwipeY

It should be set by default now, so there's no need to declare it.

Tried your fiddle and it seems to be working fine wit the current bxSlider (v4. 1. 2).



来源:https://stackoverflow.com/questions/14460057/bxslider-touch-enabled-disable-vertical-touch-events-so-only-horizontal-touch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!