0
我有一系列的列表项。在iPhone(触控设备)上,当用户在屏幕上触摸并移动他的手指时,我想要捕捉他触摸的所有元素。如何检测touchmove上的html元素
那么我该如何得到它呢?假设我想获得这些元素的所有ID,并在触摸结束时发出警报。
我试图用jQuery Mobile的以“刷”事件,但只有第一个被感动,太如果‘触摸’开始从特定的元素出现。
我有一系列的列表项。在iPhone(触控设备)上,当用户在屏幕上触摸并移动他的手指时,我想要捕捉他触摸的所有元素。如何检测touchmove上的html元素
那么我该如何得到它呢?假设我想获得这些元素的所有ID,并在触摸结束时发出警报。
我试图用jQuery Mobile的以“刷”事件,但只有第一个被感动,太如果‘触摸’开始从特定的元素出现。
不知道这是否会在工作移动设备,除非你禁用滚动。
工程桌面和还挺我的iPhone
JS
// List of events: http://api.jquery.com/category/events/
// tap taphold swipe swiperight swipeleft
// click change dblclick submit
function bindEvents(element) {
element.bind('mouseenter', function(event) {
//alert('Element Id: '+$(element).attr('id')+' Event: '+event.type);
console.log('Element Id: '+$(element).attr('id')+' Event: '+event.type);
});
}
$('#theList li').each(function(){
bindEvents($(this));
});
HTML
<div data-role="page" class="type-home">
<div data-role="content">
<ul id="theList" data-role="listview" data-inset="true" data-theme="c" data-dividertheme="f">
<li id="list-d" data-role="list-divider">Items</li>
<li id="list-item-1"><a href="#">List Item 1</a></li>
<li id="list-item-2"><a href="#">List Item 2</a></li>
<li id="list-item-3"><a href="#">List Item 3</a></li>
<li id="list-item-4"><a href="#">List Item 4</a></li>
<li id="list-item-5"><a href="#">List Item 5</a></li>
<li id="list-item-6"><a href="#">List Item 6</a></li>
<li id="list-item-7"><a href="#">List Item 7</a></li>
<li id="list-item-8"><a href="#">List Item 8</a></li>
<li id="list-item-9"><a href="#">List Item 9</a></li>
<li id="list-item-10"><a href="#">List Item 10</a></li>
</ul>
</div>
</div>
我敢肯定,你可以绑定多个事件和日志他们找到你正在寻找正确的组合。