在Google地图里,使用自定义marker在地图上添加自定义的文字标示,代码:
var Guangzhou=new google.maps.LatLng(23.134819460,113.3768628603);
function initialize()
{
var mapProp = {
center:Guangzhou,
zoom:2,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
var marker_Guangzhou=new google.maps.Marker({
position:Guangzhou,
icon:'images/icon.png',
animation:google.maps.Animation.BOUNCE
});
marker_Guangzhou.setMap(map);
var contentString_Guangzhou = '
2095-2096, 2nd Floor, Tian Ying Creative Park
No.288-289 Tang An Rd., Tian He District
Guangzhou, China
Tel: +86 20 85553125
http://www.s3triple.com
var infowindow_Guangzhou = new google.maps.InfoWindow({
content: contentString_Guangzhou
});
google.maps.event.addListener(marker_Guangzhou,'mouseover',function() {
infowindow_Guangzhou.open(map,marker_Guangzhou);
});
google.maps.event.addListener(marker_Guangzhou,'mouseout',function() {
infowindow_Guangzhou.close(map,marker_Guangzhou);
});
google.maps.event.addListener(marker_Guangzhou,'click',function() {
map.setZoom(13);
map.setCenter(marker_Guangzhou.getPosition());
});
}
google.maps.event.addDomListener(window, 'load', initialize);
但现在有一个问题,在文字标示里添加了网址,现在想通过这个标示,点击跳转到上面显示的网址,但是不知道是否mouseover和mouseout的关系,鼠标移动在所地位的地方,标示出现,但鼠标想移动在出现的文字标示上,整个文字标示就消失了,有没有办法能让鼠标正常移动在文字标示上,而将鼠标移开文字标示,整个文字标示又隐藏呢?
曾经尝试过将mouseover和mouseout改成mouseenter和mouseleave,mouseenter是无法出现文字标示的,mouseleave是无法让鼠标移开后隐藏文字标示的。
请问要如何修改代码实现我的目的呢?