gpt4 book ai didi

javascript - 如何删除标记信息窗口中的 "x"关闭按钮?

转载 作者:行者123 更新时间:2023-12-02 14:30:10 27 4
gpt4 key购买 nike

如何删除标记信息窗口中的“X”按钮?

[ “美人鱼奥布里卡(原名:奥布里·亚历克西斯)”, 36.8618,-76.203, 5、 “迈克·欧文/乔治亚·梅森”, “USAVE汽车租赁”, “弗吉尼亚海滩大道上的弗吉尼亚汽车租赁”, “ Assets /图像/1.jpg”, “成立” ] ]

var map = new google.maps.Map(document.getElementById('map'), {
zoom: 12,
// center: new google.maps.LatLng(-33.92, 151.25),
center: new google.maps.LatLng(36.8857, -76.2599),
mapTypeId: google.maps.MapTypeId.ROADMAP
});

var infowindow = new google.maps.InfoWindow();
var marker, i;

for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map
});
google.maps.event.addListener(marker, 'mouseover', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker, this);
marker.addListener('click', function() {
map.setCenter(marker.getPosition());
document.getElementById("map").style.width = "50%";
google.maps.event.trigger(map, 'resize')
map.setCenter(marker.getPosition());
document.getElementById("data").style.display = "inline";
document.getElementById("data").innerHTML = locations[i][0] + "<br />" + locations[i][4] + "<br />" + locations[i][5] + "<br />" + locations[i][6] + "<br />" + '<div class="row"><div class="col-md-4"><img class="img-responsive" src="' + locations[i][7] + '" /></div></div>';
document.getElementById("button").style.display = "block";
});
}
})(marker, i, infowindow));
google.maps.event.addListener(marker, 'mouseout', function() {
infowindow.close();
});
}

最佳答案

这里有一个 CSS hack 可以完成这项工作,但如果将来 URL 发生变化,它可能就不那么好了......

    <style>
img[src="http://maps.gstatic.com/mapfiles/api-3/images/mapcnt3.png"] {
display: none;
}
</style>

尝试检查页面以获取正确的图像资源...可能是...

https://maps.gstatic.com/mapfiles/api-3/images/mapcnt6.png

而不是我引用的。

关于javascript - 如何删除标记信息窗口中的 "x"关闭按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37898281/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com