相关疑难解决方法(0)

是否存在与'touchstart'事件相同的e.PageX位置,因为有点击事件?

我试图用一个touchstart事件的jQuery获得X位置,与live函数一起使用?

$('#box').live('touchstart', function(e) { var xPos = e.PageX; } );
Run Code Online (Sandbox Code Playgroud)

现在,这可以使用'click'作为事件.如何(不使用alpha jQuery Mobile)我是否通过触摸事件获得它?

有任何想法吗?

谢谢你的帮助.

javascript jquery events click touch

102
推荐指数
4
解决办法
10万
查看次数

了解jQuery Mobile Swipe Configuration变量

我们一直在研究iPad应用程序,并使用jQuery Mobile来处理诸如滑动(更改页面)之类的事件.在测试应用程序时,很明显默认的滑动配置变量感觉不对.尝试滚动时滑动太敏感,反之亦然.

我们已经使用了配置变量,但我们不确定我们是否了解每个配置变量的作用.我们制作了一个图形,以帮助我们了解它们如何协同工作.我们是正确理解这个还是遗漏了什么?

jQuery Mobile Swipe配置(以漫画Sans的风格)

jquery-mobile

16
推荐指数
1
解决办法
7091
查看次数

在jQuery-mobile中计算滑动距离

我希望你今天很好,我正在尝试计算移动网站上的滑动距离(触摸手势),你将如何计算出用户在屏幕上滑动了多少像素?

$('.cmButtons').live('swipeleft',function(){
    console.log("swiped left");
});
Run Code Online (Sandbox Code Playgroud)

jquery-mobile

8
推荐指数
2
解决办法
1万
查看次数

处理draggables/droppables的iPad touch事件(undefined changedTouches)

我试图让jQuery拖放与iPad touch事件很好地协同工作.我在互联网上找到了这个代码:

function touchHandler(event)
{
    var touches = event.changedTouches,
        first = touches[0],
        type = "";
    switch (event.type)
    {
        case "touchstart": type = "mousedown"; break;
        case "touchmove": type = "mousemove"; break;
        case "touchend": type = "mouseup"; break;
        default: return;
    }

    //initMouseEvent(type, canBubble, cancelable, view, clickCount, 
    //           screenX, screenY, clientX, clientY, ctrlKey, 
    //           altKey, shiftKey, metaKey, button, relatedTarget);

    var simulatedEvent = document.createEvent("MouseEvent");
    simulatedEvent.initMouseEvent(type, true, true, window, 1,
                              first.screenX, first.screenY,
                              first.clientX, first.clientY, false,
                              false, false, false, 0/*left*/, null);

    first.target.dispatchEvent(simulatedEvent);
    event.preventDefault();
}
Run Code Online (Sandbox Code Playgroud)

如果我将touchHandler附加到document …

javascript jquery jquery-ui touch-event

7
推荐指数
1
解决办法
2968
查看次数

jQuery live()删除iPhone touch事件属性?

我在我的PhoneGap应用程序中的链接上绑定现场活动.事件成功触发(通过alert()ing 确认),但似乎任何触摸数据都没有像应该的那样附加到事件对象.这发生在所有触摸事件, - touchstart,touchmovetouchend.

$('a').live('touchend', function(event) {
  event.preventDefault();
  alert(event.touches.length); // event.touches should be populated!
});
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?我是使用jQuery.live()的SOL吗?

iphone jquery live touch

6
推荐指数
2
解决办法
9366
查看次数