javascript Google Map API v3 Ghetto示例
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript Google Map API v3 Ghetto示例相关的知识,希望对你有一定的参考价值。
function initialize() {
var myOptions = {
zoom: 11,
center: new google.maps.LatLng(37.392391,-122.059822),
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
/* THE MARKER */
var image = '/images/now_open.png';
var myLatLng = new google.maps.LatLng(37.392152,-122.072041);
var contentString = '<div style="height: 180px;"><h1 style="font-size: 17px; margin: 0px 5px 0px 0px; padding: 0px 0px 0px 0px;">Classics at Station 361</h1><h2 style="font-size: 15px; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;">NOW OPEN</h2><p>Townhomes and Single-family homes in<br />Downtown Mountain View</p><p>209 W Evelyn Ave<br />Mountain View, CA 94041</p><p><a href="http://classicsstation361.com/" style="display: block; padding: 4px 10px 4px 10px; text-align: center; width: 160px; background-color: #e56f00; color: #FFFFFF; text-decoration: none; font-size: 13px;">Visit Website ></a></p></div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var beachMarker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: image,
title: 'Classics at Station 361'
});
google.maps.event.addListener(beachMarker, 'click', function() {
infowindowTwo.close();
infowindow.open(map,beachMarker);
});
/* THE MARKER TWO */
var imageTwo = '/images/coming_soon.png';
var myLatLngTwo = new google.maps.LatLng(37.400918,-122.016003);
var contentStringTwo = '<h1 style="font-size: 17px; margin: 0px 5px 0px 0px; padding: 0px 0px 0px 0px;">Classics at Tasman Crossing</h1><h2 style="font-size: 15px; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;">COMING LATE 2012</h2><p>17 Townhomes in Sunnyvale</p><p>1060 Morse Ave<br />Sunnyvale, CA 94089</p>';
var infowindowTwo = new google.maps.InfoWindow({
content: contentStringTwo
});
var beachMarkerTwo = new google.maps.Marker({
position: myLatLngTwo,
map: map,
icon: imageTwo,
title: 'Classics at Tasman Crossing'
});
google.maps.event.addListener(beachMarkerTwo, 'click', function() {
infowindow.close();
infowindowTwo.open(map,beachMarkerTwo);
});
}
$(document).ready(function() {
initialize();
});
以上是关于javascript Google Map API v3 Ghetto示例的主要内容,如果未能解决你的问题,请参考以下文章
javascript Google Map API v3 Ghetto示例
JavaScript 测试Google Map API(testgmap.js)
使用 google map javascript api v3 在 google map 上添加多个目的地
html Google Map Javascript API v3の基本の使い方
使用JavaScript覆盖Google Map API中标记弹出窗口上的默认文本?
Angularjs - ng-map - Google Maps Javascript API v3 - 如何为多个标记设置最佳缩放