谷歌地图信息窗口显示/隐藏动作

时间:2014-07-04 12:56:27

标签: javascript jquery google-maps

我正在尝试在Google地图标记信息窗口中设置一些显示/隐藏操作。我通过mouseovermouseout事件执行此操作,但我与jQuery有一些冲突...所以,代码:

newmarker['infowindow'] = new google.maps.InfoWindow({
    content: html
});

google.maps.event.on(newmarker, {
    mouseover : function(){
        this['infowindow'].open(map, this)
    },
    mouseout : function() {
        this['infowindow'].close(map, this)
    }
});

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:2)

尝试喜欢

google.maps.event.addListener(marker, 'mouseover', function() {
    infowindow.open(map, this);
});

// assuming you also want to hide the infowindow when user mouses-out
google.maps.event.addListener(marker, 'mouseout', function() {
    infowindow.close();
});

Demo

Demo1