0
我已經內部文檔準備下面的代碼用來隱藏菜單點擊文件(背景)時。這工作正常。但是,如果用戶開始拖動,我需要取消隱藏 - touchstart
。因此,如果用戶觸摸並「釋放」或取消觸摸,則隱藏菜單。但是,如果他們觸摸並開始拖動以查看更多菜單,菜單將保持可見。因爲它是現在,我嘗試取消如果touchmove
啓動了touchend
,但是這是行不通的。它仍然隱藏菜單。任何幫助在這裏將不勝感激。取消touchend如果用戶觸摸拖動
var touchmove = false;
$(document).on('touchmove',function() {
touchmove = true;
})
var click_or_touch = is_touch_divice ? 'touchend' : 'click'
$(this).on(click_or_touch, function() {
if (touchmove == true) return false;
if ($('.popup_item').is(':visible')) {
$('.popup_item').hide();
}
});
感謝喬納森 - 我認爲這將永遠不會得到回答;) – Chris