Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript google map多标记工具提示仅显示在firefox 32中的第一个标记上_Javascript_Google Maps_Firefox_Google Maps Api 3 - Fatal编程技术网

Javascript google map多标记工具提示仅显示在firefox 32中的第一个标记上

Javascript google map多标记工具提示仅显示在firefox 32中的第一个标记上,javascript,google-maps,firefox,google-maps-api-3,Javascript,Google Maps,Firefox,Google Maps Api 3,下面的小提琴显示了这个问题——如果你将鼠标放在一个有多个pin的地图上,只有第一个pin会在Firefox32上显示标题。您必须在div外部单击,然后获取另一个pin以显示标题。我正在使用一个相关问题的公认答案中的提琴,但它似乎对ff32不起作用 它在铬上工作良好。在Windows和OSX上的FF32上测试。我还在Mac上测试了FF31,它也有同样的问题 下面是小提琴上的代码: <script src='https://maps.googleapis.com/maps/api/js?v=

下面的小提琴显示了这个问题——如果你将鼠标放在一个有多个pin的地图上,只有第一个pin会在Firefox32上显示标题。您必须在div外部单击,然后获取另一个pin以显示标题。我正在使用一个相关问题的公认答案中的提琴,但它似乎对ff32不起作用

它在铬上工作良好。在Windows和OSX上的FF32上测试。我还在Mac上测试了FF31,它也有同样的问题

下面是小提琴上的代码:

<script src='https://maps.googleapis.com/maps/api/js?v=3&sensor=false'> </script>
<a href="#" onclick='mapDisplay()'>Show Map</a>
<div id="map" style="width:100%; margin-top:10px; margin-bottom:10px;"></div>

以下是JS:

function mapDisplay(){  
    var locations =  [[23.862162, 90.400749, "2014-07-21 03:20:32"], [15.88216, 92.480751, "2014-07-21 03:20:32"], [24.852161, 91.450752, "2014-08-04 08:23:42"], [36.782162, 83.380753, "2014-08-06 10:12:10"]];
    //
    if(locations.length > 0)
    {
        $("#map").css({'height': '600px'});

        var map = new google.maps.Map(document.getElementById('map'), {
            //zoom: 8,
            //center: new google.maps.LatLng(((locations[0][0]+locations[locations.length-1][0])/2), ((locations[0][1]+locations[locations.length-1][1])/2)),
        mapTypeId: google.maps.MapTypeId.ROADMAP
    });

        var marker, point, travelCoordinates = new Array();
        var bounds = new google.maps.LatLngBounds();

        for (var i = 0; i < locations.length; i++) {
            point = new google.maps.LatLng(locations[i][0], locations[i][1]);
            marker = new google.maps.Marker({
                position: point,
                map: map,
                title: locations[i][2]
            });

            travelCoordinates[i] = point 
            bounds.extend(marker.position); 
        }
        map.fitBounds(bounds);
        if(map.getZoom()> 10){
            map.setZoom(10);
        }

        var travelPath = new google.maps.Polyline({
            path: travelCoordinates,
            geodesic: true,
            strokeColor: '#FF0000',
            strokeOpacity: 1.0,
            strokeWeight: 2
        });

        travelPath.setMap(map); 
    }
    else
    {
        $("#map").empty();
        $("#map").css({'background-color': '','height': 'auto'});
        $("#map").html("No records found");
    }   

}
函数mapDisplay(){
风险值位置=[[23.86216290.400749,“2014-07-2103:20:32”],[15.8821692.480751,“2014-07-2103:20:32”],[24.85216191.450752,“2014-08-0408:23:42”],[36.78216283.380753,“2014-08-0610:12:10”];
//
如果(位置.长度>0)
{
$(“#map”).css({'height':'600px'});
var map=new google.maps.map(document.getElementById('map'){
//缩放:8,
//中心:新的google.maps.LatLng(((locations[0][0]+locations[locations.length-1][0])/2),((locations[0][1]+locations[locations.length-1][1])/2),
mapTypeId:google.maps.mapTypeId.ROADMAP
});
变量标记、点、移动坐标=新数组();
var bounds=new google.maps.LatLngBounds();
对于(变量i=0;i10){
map.setZoom(10);
}
var travelPath=新的google.maps.Polyline({
路径:旅行坐标,
测地线:正确,
strokeColor:“#FF0000”,
笔划不透明度:1.0,
冲程重量:2
});
travelPath.setMap(map);
}
其他的
{
$(“#映射”).empty();
$(“#map”).css({'background-color':'','height':'auto'});
$(“#map”).html(“未找到任何记录”);
}   
}

好奇。我的建议是,不要在用户点击时创建地图,而是在页面加载时创建地图,但不要显示它。然后单击链接时显示/隐藏它。可能重复我测试的优化:错误设置,这使它更好一些-一些pin标题将显示,但不是全部。我没有任何名声去评论另一个,以表明它至少在FF32上不起作用,因此创建了一个针对FF32的新问题。我使用optimize:false选项进行了更多测试,这似乎解决了ff上的问题,我没有注意到其他浏览器上的任何其他问题,所以这可能是当前最好的变通办法。