jquery - 云轮播和 iPad/iPhone 触摸事件

标签 jquery iphone ipad touch

真的很喜欢这个轮播: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/

相关文章:

javascript - Firefox 和 Chrome/IE 中的 jQuery animate() 不同

ios - 通话进行时如何管理应用程序 View ?

iphone - Facebook ios sdk : Page not found message after integrate it into my App

ios - 在 iOS 上设置独立于设备的 RGB

iphone - 生成大型 PDF 文件缩略图导致 iPhone/iPad 崩溃

javascript - 动态创建 Bootstrap CSS 警报消息

javascript - 如何保持每次提交后延迟10秒

javascript - 如何在 jQuery 的 Ajax 自动完成中传递额外参数?

iPhone 如何创建全屏应用程序?

ios - 当菜单弹出窗口可见时,UISplitViewController 会缩小左侧