真的很喜欢这个轮播:http://www.professorcloud.com/mainsite/carousel.htm
除了我需要为 iOS 和 Android 添加触摸/删除事件之外,它完全按照我需要的演示方式工作。
基本上,如果用户向左或向右删除(这是正确的术语吗?),轮播就会朝该方向移动,就像按向左或向右按钮时一样。
我研究过使用这个插件:http://plugins.jquery.com/project/Touchwipe-iPhone-iPad-wipe-gesture
然后尝试调整(破解)轮播插件以监听这些事件
$(container).bind('touchwipe',this,function(event){
wipeLeft: function() { alert("left"); }
});
但这会产生语法错误。我对创建插件了解不够,不知道这里允许什么。
据我在插件中所知,向左/向右滚动功能就在这里
// Setup the buttons.
$(options.buttonLeft).bind('mouseup',this,function(event){
event.data.rotate(-1);
return false;
});
$(options.buttonRight).bind('mouseup',this,function(event){
event.data.rotate(1);
return false;
});
所以我想我需要连接这些。
我应该使用附加插件来创建删除事件,还是应该尝试官方触摸事件?
谢谢!
最佳答案
这段代码对我有用
$(container).bind('swiperight', this, function(event, ui)
{
event.preventDefault();
event.data.rotate(-3);
});
$(container).bind('swipeleft', this, function(event, ui)
{
event.preventDefault();
event.data.rotate(3);
});
不要忘记添加 jQuery mobile http://jquerymobile.com/
关于jquery - 云轮播和 iPad/iPhone 触摸事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4949393/