2017-09-13 88 views
0

單擊在我的應用程序的觸摸設備上無法識別雙擊(但雙擊放大即可 - 只需打開開發工具並選擇移動設備以查看該錯誤):https://express-tourism.herokuapp.com/
我認爲這可能是因爲我在另一個全局包裝器DIV中映射了DIV,但事實並非如此。即使當我在控制檯上鍵入'地圖'時,它也會顯示doubleClickZoom is enabled
我是否必須手動添加該雙擊功能還是缺少一些東西?單擊雙擊不放大

UPDATE:@Baptiste是對的 - 我不得不添加自定義雙擊功能:

var tapped=false 
    $("#map").on("touchstart",function(e){ 
    if(!tapped){ //if tap is not set, set up single tap 
     tapped=setTimeout(function(){ 
      tapped=null 
      //insert things you want to do when single tapped 
     },300); //wait 300ms then run single click code 
    } else { //tapped within 300ms of last tap. double tap 
     clearTimeout(tapped); //stop single tap callback 
     tapped=null 
     //insert things you want to do when double tapped 
     map.zoomIn(1) 
    } 
}); 

回答