Cloud Carousel和iPad / iPhone触摸事件

问题描述 投票:3回答:3

真的很喜欢这个旋转木马: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;
    }); 

所以我想我需要联系到这些。

我应该使用附加插件来创建擦除事件,还是应该尝试官方触摸事件?

谢谢!

jquery iphone ipad touch
3个回答
2
投票

这段代码适合我

    $(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


1
投票

http://www.albanx.com/?pid=5&subid=18并下载我已经适应接触的版本(也适用于PC)设备。如果要查看详细信息,请查看源代码。希望有所帮助


-1
投票

我在iScroll和它的旋转木马上取得了成功。

http://cubiq.org/iscroll-4

或者你可以自己动手

https://developer.apple.com/documentation/webkitjs/touchevent

© www.soinside.com 2019 - 2024. All rights reserved.