该链接有效,但是除非我突出显示它,否则它不会显示,然后我才能看到文本。
这些是多个标记。
var markers = [
['Joe Brown Park, New Orleans', 29.993345,-90.098104],
['City Park, New Orleans', 30.030401,-89.966602],
['Palace of Westminster, London', 30.020819,-90.040573]
];
这是信息窗口的内容。
除非我突出显示它们,否则所有这三个链接都是不可见的。
var infoWindowContent = [
[
'<h3>"Named after 1 of the states largest independent oil producers, this park offers year-round events."</h3>' +
'<h3></h3>' +
'<h3><a href="http://nordc.org/parks/joe-w-brown-park/">Joe Brown Park</a></h3>' +
'</div>'],
[
'<h3>"City Park, a 1,300 acre public park in New Orleans, Louisiana, is the 87th largest and 7th-most-visited urban public park in the United States."</h3>' +
'<h3></h3>' +
'<h3><a href="http://neworleanscitypark.com/">City Park</a></h3>' +
'</div>'],
[
'<h3>"City Park, a 1,300 acre public park in New Orleans, Louisiana, is the 87th largest and 7th-most-visited urban public park in the United States."</h3>' +
'<h3></h3>' +
'<h3><a href="http://neworleanscitypark.com/">City Park</a></h3>' +
'</div>']
];
我从标题中删除了它们,删除并添加了单/双引号。我想念什么吗?
参考方案
似乎文字不是不可见的,而是文字颜色设置为白色。尝试为信息窗口明确指定文本颜色,例如:
.gm-style .gm-style-iw, .gm-style .gm-style-iw a {
color: #000;
}
例
function initMap() {
var uluru = { lat: 29.993345, lng: -90.098104 };
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 12,
center: uluru
});
var markers = [
['Joe Brown Park, New Orleans', 29.993345, -90.098104],
['City Park, New Orleans', 30.030401, -89.966602],
['Palace of Westminster, London', 30.020819, -90.040573]
];
var infoWindowContent = [
[
'<h3>"Named after 1 of the states largest independent oil producers, this park offers year-round events."</h3>' +
'<h3></h3>' +
'<h3><a href="http://nordc.org/parks/joe-w-brown-park/">Joe Brown Park</a></h3>' +
'</div>'],
[
'<h3>"City Park, a 1,300 acre public park in New Orleans, Louisiana, is the 87th largest and 7th-most-visited urban public park in the United States."</h3>' +
'<h3></h3>' +
'<h3><a href="http://neworleanscitypark.com/">City Park</a></h3>' +
'</div>'],
[
'<h3>"City Park, a 1,300 acre public park in New Orleans, Louisiana, is the 87th largest and 7th-most-visited urban public park in the United States."</h3>' +
'<h3></h3>' +
'<h3><a href="http://neworleanscitypark.com/">City Park</a></h3>' +
'</div>']
];
var infowindow = new google.maps.InfoWindow({
content: ''
});
markers.forEach(function (markerInfo, i) {
markerInfo.content = infoWindowContent[i][0];
createMarker(map,infowindow, markerInfo);
});
}
function createMarker(map,infoWindow,info) {
var marker = new google.maps.Marker({
position: new google.maps.LatLng(info[1], info[2]),
map: map,
title: info[0]
});
marker.addListener('click', function () {
infoWindow.setContent(info.content);
infoWindow.open(map, marker);
});
return marker;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
height: 100%;
}
.gm-style .gm-style-iw, .gm-style .gm-style-iw a {
color: #000;
}
<div id="map"></div>
<script async defer
src="https://maps.googleapis.com/maps/api/js?callback=initMap"></script>
PHP PDO组按列名称查询结果 - php以下PDO查询返回以下结果:$db = new PDO('....'); $sth = $db->prepare('SELECT ...'); 结果如下: name curso ABC stack CDE stack FGH stack IJK stack LMN overflow OPQ overflow RS…
在单击时显示特定行的SQL数据 - php我目前有2张桌子,顶部和底部。最上面的是我从SQL数据库调出的数据行。至于底部,数据来自与顶部表相同的数据库,但显示不同的字段。这些字段都在我的SQL数据库的同一行中。基本上,单击顶部表中的任何行,底部表将显示更多信息,这些信息也在SQL数据库的同一行内。我不确定如何显示特定行的数据,现在,当我单击顶部表中的任何行时,它将显示SQL中的所有行。表格代码:&l…
在Javascript或PHP中查找并替换<a>标签 - php我正在尝试获取执行JavaScript而不是href属性的链接。我已经在网上搜寻,可以使用几种不同的方法来接近,但没有雪茄。转换示例如下所示:<a href="http://example.com">Link 1</a> <a href="http://www.yahoo.com" tar…
php Singleton类实例将在多个会话中保留吗? - php举一个简单的例子,如果我想计算一个不使用磁盘存储的脚本的命中次数,我可以使用静态类成员来执行此操作吗?用户1:<?php $test = Example::singleton(); $test->visits++; ?> 用户2:<?php $test = Example::singleton(); $test->visits+…
通过>和<运算符比较日期 - php在我的所有php代码中,我都在UTC中存储日期和时间,但是我也在使用mysql存储日期时间(也在utc中)。大于和小于运算符会导致日期比较失败吗? $curdate=date('Y-m-d H:i:s'); if($start_datetime>$curdate) 参考方案 不。他们没有办法失败。为此,特意制作了MySQL日期格式。…