2017-09-13 89 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) 
    } 
}); 

回答