且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何:点击标记时 - 使地图变暗并在信息图上显示一个大的div而不是信息框

更新时间:2023-01-07 14:35:37

在您的循环添加标记时,添加如下内容:

  google.maps.event.addListener(marker,'click',(function(marker,i){
return function(){
... your code ...
}
})

在您的代码中,您需要确定地图大小,并在顶部放置一个半透明的DIV,然后在地图的脱机区域中显示自己的绝对定位的DIV元素。


I have a Google Map with filterable markers and info-boxes containing simple information about each marker( when you click them ), but was wondering if this is possible:

When you would click on a marker - instead of a default info-box a big div appears on top of the map with tabs which shows all the possible data I will provide about a marker via JSON ( images, links, pictures ).

How would you approach about implementing this functionality?

In your loop to add markers, add something like this:

google.maps.event.addListener(marker, 'click', (function(marker, i) {
        return function() {
           ... your code ...
        }
     })
)

In your code you need to determine the map size and put a translucent DIV over top, then show your own HTML absolutely-positioned DIV inside the map's weapping element.