我正在设置一个谷歌地图的联系页面。点击后我创建了一个图钉和阴影以及一个信息框。在信息框内,我想使用哥白尼的自定义字体。我已经在页面标题中使用了js cufon替换脚本。现在我想知道我是否可以在信息框中使用它,因为我已经有地图的js脚本了?如果是这样,怎么样?
截至目前,我的脚本如下所示:
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(31.4249122, 117.6179591);
var settings = {
zoom: 15,
center: latlng,
mapTypeControl: true,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
navigationControl: true,
navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), settings);
var contentString = '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h1 id="firstHeading" class="firstHeading">Header placed here</h1>'+
'<div id="bodyContent">'+
'<p>Description of business placed Here</p>'+
'</div>'+
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var companyLogo = new google.maps.MarkerImage('/imgs/mapMarker.png',
new google.maps.Size(100,50),
new google.maps.Point(0,0),
new google.maps.Point(50,50)
);
var companyShadow = new google.maps.MarkerImage('/imgs/mapShadow.png',
new google.maps.Size(130,50),
new google.maps.Point(0,0),
new google.maps.Point(65, 50)
);
var companyPos = new google.maps.LatLng(31.4249122, 117.6179591);
var companyMarker = new google.maps.Marker({
position: companyPos,
map: map,
icon: companyLogo,
shadow: companyShadow,
title:"Company Title"
});
google.maps.event.addListener(companyMarker, 'click', function() {
infowindow.open(map,companyMarker);
});
}
</script>
提前致谢!
答案 0 :(得分:0)
尝试使用Cufon.refresh()
:
google.maps.event.addListener(companyMarker, 'click', function() {
infowindow.open(map,companyMarker);
Cufon.refresh();
});
它将使用初始选择器重新运行Cufon
字体替换...