天天看點

長按事件jquery mobile

chat_enlarge.addEventListener('touchend', function(event) {
            if(fingers == 1){
                event.preventDefault();
                // 如果長按事件超過 1秒,則提示彈出是否儲存框
                if((new Date()).getTime() - startTime > 1 * 1000){
                    // 調用原生方法儲存圖檔
                    //二次确認判斷
                    _TTPopups.open2({
                        content:"您确定要儲存圖檔嗎?",
                        cancelBtn:"否",
                        submitBtn:"是",
                        closeCallBack:"saveIMG"
                      });
                } else {
                    // 長按時間過短則隐藏圖檔顯示層
                    document.body.removeChild(document.getElementById("chat_enlarge"));
                    document.body.removeChild(document.getElementById("maskId"));
                    // 去除滾動條不可滾動的限制
                    document.ontouchmove = function(e){}
                }
            }
}, false);      

轉載于:https://www.cnblogs.com/binmengxue/p/5287512.html

繼續閱讀