【问题标题】:Google Maps Directions List Jquery Mobile/HTML5谷歌地图方向列表 Jquery Mobile/HTML5
【发布时间】:2012-11-01 20:16:02
【问题描述】:

我在客户端设备上使用 HTML5 localstorage 存储了开始和结束坐标。要显示他在开始和结束之间的路线,我必须使用谷歌地图驾驶列表(不是地图..只是文本格式的方向)应用程序在 jquery mobile 中。

<div data-role="content">

    <div data-role="content" id="list"> 
    <ul data-role="listview" data-inset="true" data-filter="true" id="myList">

我可以在我的列表视图中添加 ID 为 myList 的行车列表吗?

 function gotDirections(geo){
        var directionsService = new google.maps.DirectionsService();
        var directionsDisplay = new google.maps.DirectionsRenderer();
        directionsDisplay.setPanel(document.getElementById("myList"));
        var storedlati=localStorage.getItem("text1");
        var storedlongi=localStorage.getItem("text");
        var destilati=localStorage.getItem("text2");
        var destilongi=localStorage.getItem("text3");
        var request = {
            origin:google.maps.LatLng(storedlati,storedlongi),
            destination:google.maps.LatLng(destilati,destilongi),
            travelMode: google.maps.TravelMode.DRIVING
        };
        directionsService.route(request, function(result, status) {
            if (status == google.maps.DirectionsStatus.OK) {
                directionsDisplay.setDirections(result);
            }
        });

    }

【问题讨论】:

  • 什么是“谷歌地图行车清单”?它只是您想要的面板的内容(如this 但没有地图)?还是有什么额外的?
  • 我想要您提供的链接右侧的列表 :)

标签: html google-maps jquery-mobile


【解决方案1】:

在这种情况下,只需在方向渲染器上设置方向面板,而不是地图;并且不要创建地图。赞这个Example

【讨论】:

  • 从我上面给出的代码中可以看出,我已将其设置为仅方向渲染器 var directionDisplay = new google.maps.DirectionsRenderer();方向Display.setPanel(document.getElementById("myList"));
  • 那么也许链接到您的实时版本会有所帮助。我发布的那个作品。
猜你喜欢
  • 2012-03-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-02
  • 1970-01-01
  • 2014-07-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多