1 var timeOutEvent = 0;
2 $("#order_list").delegate(".renewalList","touchstart",function(e){
3 var that = $(this);
4 longClick=0;//设置初始为0
5 currIndex = that.data("value");
6 // console.log(currIndex);
7 // 将当前元素的索引作为参数进行传递
8 timeOutEvent = setTimeout(function () {
9 longClick=1;//假如长按,则设置为1
10 $(".delete_popup").show();
11 }, 1000);
12 })
13 $("#order_list").delegate(".renewalList","touchmove",function(e){
14 clearTimeout(timeOutEvent);
15 timeOutEvent = 0;
16 //e.preventDefault();
17 })
18 $("#order_list").delegate(".renewalList","touchend",function(e){
19 var that = $(this);
20 /* console.log(that.data("value"));*/
21 currIndex = that.data("value");
22 clearTimeout(timeOutEvent);
23 if(timeOutEvent!=0 && longClick==0) {
24 window.location.href = "searchDetails.html?id=" + currIndex + "&renewalId="+currIndex;
25 } /*else {
26 $(".delete_popup").show();
27 }*/
28 timeOutEvent==0;
29 return false;
30 })