Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.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
Google maps 带有标记管理器的信息窗口Google Maps V3_Google Maps_Google Maps Markers_Infowindow_Markerclusterer - Fatal编程技术网

Google maps 带有标记管理器的信息窗口Google Maps V3

Google maps 带有标记管理器的信息窗口Google Maps V3,google-maps,google-maps-markers,infowindow,markerclusterer,Google Maps,Google Maps Markers,Infowindow,Markerclusterer,我有许多具有完全相同的横向/纵向线条的地图标记,因此无论我放大多远,我的地图仍然显示标记簇和结果数 有没有办法让onclick或onhover事件在列表中显示一个包含该集群中所有标记的信息框?然后单击该信息框中的链接打开单个标记信息框 我已经阅读了改变lat的解决方案,长一点,这样它们就不在同一位置了。我认为这是非常混乱的,而且如果在同一个位置有多个标记10+无论如何都不是很好。我认为,用户只需单击集群并打开信息窗口,其中包含所有带有链接的标记,就可以轻松得多 或者,如果有人知道另一个插件可以实

我有许多具有完全相同的横向/纵向线条的地图标记,因此无论我放大多远,我的地图仍然显示标记簇和结果数

有没有办法让onclick或onhover事件在列表中显示一个包含该集群中所有标记的信息框?然后单击该信息框中的链接打开单个标记信息框

我已经阅读了改变lat的解决方案,长一点,这样它们就不在同一位置了。我认为这是非常混乱的,而且如果在同一个位置有多个标记10+无论如何都不是很好。我认为,用户只需单击集群并打开信息窗口,其中包含所有带有链接的标记,就可以轻松得多


或者,如果有人知道另一个插件可以实现我正在寻找的功能,我也可以使用它。我只是没有找到太多关于它的信息。

可能有一个插件,可以做你想做的事情,但是也可以不用它。我在我的一个项目中做过类似的事情

  • 向每个标记添加事件侦听器;单击打开标记列表信息窗口
  • 标记列表信息窗口的内容包含将打开标记信息窗口的
    onclick
    属性
  • 我的代码隐藏在函数中,但基本上就是这样:

    //1) while creating marker, create click listener that opens the marker list
    google.maps.event.addListener(marker, 'click', function() {
        markerWindow.close();
        markerList.open(map, marker);
    });
    
    //2) store the content required by the marker's info windows
    var markers = [
        [marker1Reference, "The Stadium"],
        [maerker2Reference, "The Supermarket"]
    ];
    
    //3) the function that is called each time a marker is chosen from the marker list
    function openMarkerInfo(markerIndex) {
        markerList.close();
        markerWindow.setContent(markers[markerIndex][1]);
        markerWindow.open(map, markers[markerIndex][0]);
    }
    
    //4) info window for the marker list - the content includes JS onclick events that will open each marker info window
    markerList = new google.maps.InfoWindow({
        content: "Choose:<br><br><div href='' class='markerLink' onclick='openMarkerInfo(0)'>The Stadium</div><br><div href='' class='markerLink' onclick='openMarkerInfo(1)'>My House</div>"
    });
    //5) the marker window that will get set each time a marker is clicked in the list
    markerWindow = new google.maps.InfoWindow();
    
    //1)创建标记时,单击“创建侦听器”打开标记列表
    google.maps.event.addListener(标记'click',函数(){
    markerWindow.close();
    markerList.open(地图、标记);
    });
    //2) 存储标记信息窗口所需的内容
    变量标记=[
    [Marker1参考,“体育场”],
    [Maerker2参考,“超市”]
    ];
    //3) 每次从标记列表中选择标记时调用的函数
    函数openMarkerInfo(markerIndex){
    markerList.close();
    markerWindow.setContent(markers[markerIndex][1]);
    markerWindow.open(map,markers[markerIndex][0]);
    }
    //4) 标记列表的信息窗口-内容包括将打开每个标记信息窗口的JS onclick事件
    markerList=new google.maps.InfoWindow({
    内容:“选择:

    体育场
    我家” }); //5) 每次在列表中单击标记时将设置的标记窗口 markerWindow=new google.maps.InfoWindow();

    希望有帮助

    那里可能有一个插件可以做你想做的事情,但也可以不用它。我在我的一个项目中做过类似的事情

  • 向每个标记添加事件侦听器;单击打开标记列表信息窗口
  • 标记列表信息窗口的内容包含将打开标记信息窗口的
    onclick
    属性
  • 我的代码隐藏在函数中,但基本上就是这样:

    //1) while creating marker, create click listener that opens the marker list
    google.maps.event.addListener(marker, 'click', function() {
        markerWindow.close();
        markerList.open(map, marker);
    });
    
    //2) store the content required by the marker's info windows
    var markers = [
        [marker1Reference, "The Stadium"],
        [maerker2Reference, "The Supermarket"]
    ];
    
    //3) the function that is called each time a marker is chosen from the marker list
    function openMarkerInfo(markerIndex) {
        markerList.close();
        markerWindow.setContent(markers[markerIndex][1]);
        markerWindow.open(map, markers[markerIndex][0]);
    }
    
    //4) info window for the marker list - the content includes JS onclick events that will open each marker info window
    markerList = new google.maps.InfoWindow({
        content: "Choose:<br><br><div href='' class='markerLink' onclick='openMarkerInfo(0)'>The Stadium</div><br><div href='' class='markerLink' onclick='openMarkerInfo(1)'>My House</div>"
    });
    //5) the marker window that will get set each time a marker is clicked in the list
    markerWindow = new google.maps.InfoWindow();
    
    //1)创建标记时,单击“创建侦听器”打开标记列表
    google.maps.event.addListener(标记'click',函数(){
    markerWindow.close();
    markerList.open(地图、标记);
    });
    //2) 存储标记信息窗口所需的内容
    变量标记=[
    [Marker1参考,“体育场”],
    [Maerker2参考,“超市”]
    ];
    //3) 每次从标记列表中选择标记时调用的函数
    函数openMarkerInfo(markerIndex){
    markerList.close();
    markerWindow.setContent(markers[markerIndex][1]);
    markerWindow.open(map,markers[markerIndex][0]);
    }
    //4) 标记列表的信息窗口-内容包括将打开每个标记信息窗口的JS onclick事件
    markerList=new google.maps.InfoWindow({
    内容:“选择:

    体育场
    我家” }); //5) 每次在列表中单击标记时将设置的标记窗口 markerWindow=new google.maps.InfoWindow();
    希望有帮助