现在,如果新的 Google 地图“VisualRefresh”不再允许阴影,您将如何在动态加载的标记图标后面放置一个白框?1
打开http://jsfiddle.net/FSffv/3/用google.maps.visualRefresh = false; 查看标记图标和google.maps.visualRefresh = true周围的白框;让它消失。
var map;
var m_NormalImageSize = 15;
var m_NormalShadowSize = m_NormalImageSize+5;
var elevator;
var myOptions = {
zoom: 6,
center: new google.maps.LatLng(47, 8),
mapTypeId: 'terrain'
};
// turn VisualRefresh on/off
google.maps.visualRefresh = false;
map = new google.maps.Map($('#map')[0], myOptions);
var img = new Image();
img.src = "http://t2.gstatic.com/images?q=tbn:ANd9GcQUnmYVY5sWfZtBlw_IELax3W8E7-jZcCXLd2HUZYtpk_AeuK4CRnJmMHj0";
var img_ratio = img.height / img.width;
if (isNaN(img_ratio))
img_ratio = 1;
var icon_size = new google.maps.Size(m_NormalImageSize, m_NormalImageSize * img_ratio);
var shadow_size = new google.maps.Size(m_NormalShadowSize, m_NormalShadowSize * img_ratio);
var image = new google.maps.MarkerImage(
"http://t2.gstatic.com/images?q=tbn:ANd9GcQUnmYVY5sWfZtBlw_IELax3W8E7-jZcCXLd2HUZYtpk_AeuK4CRnJmMHj0",
icon_size,
new google.maps.Point(0, 0),
new google.maps.Point(-3, m_NormalImageSize * img_ratio + 3 * img_ratio),
icon_size
);
// the frame around the marker icon as a shadow
var shadow = new google.maps.MarkerImage(
"http://alsotoday.com/jpg/placemarkbackground_white.png",
shadow_size,
new google.maps.Point(0, 0),
new google.maps.Point(0, m_NormalShadowSize * img_ratio),
shadow_size
);
var marker = new google.maps.Marker({
position: new google.maps.LatLng(47, 8),
map: map,
icon: image,
shadow: shadow,
title: "hallo"
});