[英]Google maps api V3 with rounded corner
我正在使用适用于JavaScript的Google Maps API v3。 我正在尝试使地图显示为圆角。 我能找到的唯一方法就是几年前的黑客攻击,涉及将信息窗口更改为信息框。
现在有没有更好的方法可以使用CSS执行此操作?
创建一个包含google map javascrip,google map3和最新jquery的html。
不要忘了添加infobubble js来完成技巧。
将以下jQuery代码添加到HTML文件
$('#homepage_map').gmap3
(
{
action:'init',
options:
{
center:[response.locations.latitude, response.locations.longitude],
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: true,
navigationControl: true,
scrollwheel: true,
mapTypeControlOptions:
{
mapTypeIds: ['Map']
},
streetViewControl: true
}
},
{
action:'clear'
},
{
action: 'addMarkers',
markers:MarkerOBJ,
marker:
{
options:
{
draggable: false,
icon: HOST+'img/icons/google_marker.png',
animation: google.maps.Animation.DROP
},
events:
{
click: function(marker, event, data)
{
var map = $(this).gmap3('get');
infoBubble = new InfoBubble({
maxWidth: 395,
shadowStyle: 1,
padding: 5,
borderRadius: 10,
arrowSize: 20,
borderWidth: 5,
borderColor: '#CCC',
disableAutoPan: true,
hideCloseButton: false,
arrowPosition: 50,
arrowStyle: 0
});
infoBubble.close();
infoBubble.setContent(data);
infoBubble.open(map, marker);
}
}
}
}
);
现在,您需要做的就是在要显示信息时添加样式表。 infoBubble.setContent(data); 其中信息气泡的数据将是html,您需要根据需要进行设置。
这个例子怎么样? http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/examples/example.html
实际上,如果您想创建自己的InfoWindow设计,则可以轻松完成。 参考: 自定义信息窗口
我也尝试过弄圆角,并找到了这种解决方案-也许会对您有所帮助? http://search.missouristate.edu/map/mobile/examples/corners.htm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.