Shows Maps with markers which contains descriptions with links to cleverroute main-page
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

76 lines
2.5 KiB

<!DOCTYPE html>
<!--
Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Picture Label for Marker</title>
<style type="text/css">
.labels {
width: 100px;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBIwzALxUPNbatRBj3Xi1Uhp0fFzwWNBkE&callback=initMap&v=beta"></script>
<script src="../dist/index.dev.js"></script>
<script>
var marker, pictureLabel;
function initMap() {
var latLng = new google.maps.LatLng(49.47805, -123.84716);
var homeLatLng = new google.maps.LatLng(49.47805, -123.84716);
var map = new google.maps.Map(document.getElementById("map_canvas"), {
zoom: 12,
center: latLng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
});
pictureLabel = document.createElement("img");
pictureLabel.src = "home.jpg";
marker = new markerWithLabel.MarkerWithLabel({
position: homeLatLng,
map: map,
draggable: true,
raiseOnDrag: true,
labelContent: pictureLabel,
labelAnchor: new google.maps.Point(-50, 0),
labelClass: "labels", // the CSS class for the label
labelStyle: { opacity: 0.5 },
});
var iw = new google.maps.InfoWindow({
content: "Home For Sale",
});
google.maps.event.addListener(marker, "click", function (e) {
iw.open(map, this);
});
}
function log(h) {
document.getElementById("log").innerHTML += h + "<br />";
}
</script>
</head>
<body onload="initMap()">
<p>
This is an example of how to use a picture as a marker label. Since the
picture label is quite large, the opacity of the label is set to 0.50 to
make it possible to get a rough idea of what's on the map behind the
picture.
</p>
<div id="map_canvas" style="height: 400px; width: 100%"></div>
</body>
</html>