原生js实现移动端h5长按事件

function swipeLeft(){
  var container = $('#mycourse_ol>li');
  container.on({
    touchstart: function(e) {   
        // 长按事件触发    
        timeOutEvent = setTimeout(function() {    
            timeOutEvent = 0;    
            alert('长按了');    
        }, 400);    
        //长按400毫秒     
        // e.preventDefault();      
    },    
    touchmove: function() {    
        clearTimeout(timeOutEvent);    
        timeOutEvent = 0;    
        alert('滑动了')
    },    
    touchend: function(e) {    
        clearTimeout(timeOutEvent);    
        if (timeOutEvent != 0) {    
            // 点击事件    
            alert('点击了');   
            
        }    
        return false;    
    } 
  })
}