真的很喜欢这个旋转木马:http://www.professorcloud.com/mainsite/carousel.htm
除了我需要为iOS和Android添加触摸/擦除事件之外,还可以完全按照我的需要进行演示。
基本上,如果用户向左或向右擦拭(是正确的术语?),旋转木马会朝那个方向移动,就像按下左或右按钮一样。
我研究了使用这个插件:http://plugins.jquery.com/project/Touchwipe-iPhone-iPad-wipe-gesture
然后尝试调整(黑客)carousel插件来收听这些事件
$(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);
});
不要忘记在http://jquerymobile.com/添加jQuery mobile
去http://www.albanx.com/?pid=5&subid=18并下载我已经适应接触的版本(也适用于PC)设备。如果要查看详细信息,请查看源代码。希望有所帮助