jquery怎么实现手机触屏图片滑动代码,手向左或向右滑动,图片滑动。不滑动的时候图片自动循环滚动

2025-05-20 06:45:43
推荐回答(2个)
回答1:

可以使用事件绑定机制。
如:
$('元素').bind({ 'touchstart mousedown' : function(){ $('#touch_tips').text('按下或触摸'); }, 'touchmove mousemove' : function(){ $('#touch_tips').text('移动中'); }, 'touchend touchcancel mouseup' : function(){ $('#touch_tips').text('松开'); }})具体请搜索【touch event】手机触屏事件。注意,不支持windows phone!

回答2:

这个问题jquery是无法实现的,你可以使用jqmobile,但是推荐使用zepto.js.不要问为什么,因为大家都用

自己用touch事件的话,会有一些问题,比如兼容性问题