html - Google Map API v3 中的清除/重置方向面板

标签 html google-maps-api-3 google-directions-api

每次我们通过方向服务搜索路线时,结果都会附加到方向面板的底部。有些人建议将 div 选项卡中的面板重置为空...任何人都可以建议如何做...

function calcRoute() {
  directionsDisplay = new google.maps.DirectionsRenderer({
    'map': map,
    'preserveViewport': false,
    'draggable': true
  });
  directionsDisplay.setPanel(
    document.getElementById("directions_panel")
  );

  // ... code to make Directions API request and display response ...
}

HTML 部分:

     <div id="directions_panel" style="width:90%"></div>

最佳答案

这应该有效:

  document.getElementById("directions_panel").innerHTML = "";

关于html - Google Map API v3 中的清除/重置方向面板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16588550/

相关文章:

javascript - 在 Canvas 折线图中显示负值

html - 使用自定义 html5 控件的 Airplay

javascript - Google map API 多个标记

javascript - 在谷歌地图 v3 中绘制可拖动形状

html - 内部有 float Div 的 Div 不适合内容

javascript - HTML 网格在我的网页右侧创建了烦人的边距

javascript - Google Places API 库不返回 photo_reference 属性

java - 无法获得完整的 HttpResponse

swift - 如何让我的谷歌地图始终跟随用户而不是让他们滚动离开

python - 谷歌方向 API : not to translate addresses into English