Tag: touchstart

如何在我的手指已经在屏幕上之后添加到DOM的元素上捕获touchmove事件?

我正在为iPad开发一个javascript / html5项目。 我需要能够在一个元素上捕获touchmove事件,直到touchstart事件触发后(即直到一个人将手指放在屏幕上之后)才会添加到DOM 。 我试过模拟一个touchstart事件并以编程方式触发它… $( “#container” ).append( element ); element.on( “touchmove”, doStuff ); var ev = $.Event( “touchstart” ); element.trigger( ev ); ……但这不起作用。 我可以让doStuff开始射击的唯一方法是抬起我的手指,然后再次触摸屏幕,触发第二次touchstart事件。 如何在我的手指已经在屏幕上之后添加到DOM的元素上捕获touchmove事件?

单击并按住以滚动,touchstart,touchmove,touchend

我有一个可滚动的div。 我希望人们能够通过“保持”滚动列表,并选择一个按钮进行点击。 问题是当按住按钮以滚动div时,它会触发点击function。 我想滚动时不要触发。 我需要一些方法来区分保持function的点击。 所以我正在使用: $(‘.panel’).bind(“touchstart mousedown”, function (e) { console.log(e.type); $(this).addClass(‘resize’); }).bind(“touchmove mousemove”, function (e) { $(this).removeClass(‘resize’); }).bind(“touchend mouseup”, function (e) { $(this).removeClass(‘resize’); $(‘.panel’).addClass(‘flip’); }); 我想到了以下解决方案。 当’.panel’被mousedown超过500 ms ,按钮激活,按下: $(this).addClass(‘resize’); 当’.panel’是mouseup ,按钮返回正常状态,然后所有按钮进行输出移动: $(this).removeClass(‘resize’); $(‘.panel’).addClass(‘flip’); 但是,如果用户mousedown ,则mousedown和mouseup操作将被取消。 只是不知道如何将其付诸实践 与此类似: http : //m.microsoft.com/windowsphone/en-us/demo/default.aspx 请建议。

使用touchstart关闭iphone / ipad上的jQuery Tools工具提示

如果检测到iphone / ipad / ipod,我会运行以下代码: $(‘.tooltip-trigger’).tooltip({offset: [20, -110],relative:true, events: { def: ‘touchstart,blur’} }); 通过声明def:’touchstart’,我得到了最初的触摸工作,而不是hover,但是盒子没有关闭并调用另一个触摸器像def:’touchstart,touchstart’不起作用。 对我来说,def:’toggle’也不合乎逻辑。 有任何想法吗?

如何在iOS设备上用touchstart替换click

目的 单击时关闭锚标记的父div。 在下面的代码中,我想在用户单击锚标记close_performance_tt时隐藏div performance_tt 。 问题 花了几个小时后,无法让它在iOS设备上运行。 在其他一切工作正常,甚至是BlackBerry 10设备。 Website performance has become an important consideration for most sites. The speed of a website affects usage and user satisfaction, as well as search engine rankings, a factor that directly correlates to revenue and retention. As a result, creating a system that is optimized for fast […]