Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function initialize() {
- var styles = [
- {
- stylers: [
- { hue: '#F2846A' },
- { saturation: 80 }
- ]
- },{
- featureType: 'road',
- elementType: 'geometry',
- stylers: [
- { lightness: 100 },
- { visibility: 'simplified' }
- ]
- },{
- featureType: 'road',
- elementType: 'labels',
- stylers: [
- { visibility: 'off' }
- ]
- }
- ];
- var mapOptions = {
- zoom: 12,
- center: new google.maps.LatLng(52.204872,0.120163),
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- styles: styles,
- scrollwheel: false
- };
- var map = new google.maps.Map(document.getElementById('map_canvas'),mapOptions);
- setMarkers(map, sites);
- infowindow = new google.maps.InfoWindow({
- content: "loading..."
- });
- }
- var sites = [
- ['The Frontroom', 52.202977,0.138938, 1, '<p>The Frontroom. <br/>23-25 Gwydir Street, Cambridge, CB1 2LG <br/>01223 305 600</p>'],
- ['Fitzwilliam Museum',52.199678,0.119931, 2, 'Fitzwilliam Museum'],
- ['Wysing Arts centre', 52.182077,-0.06977, 3, 'Wysing Arts Centre'],
- ['Cambridge School of Art', 52.203825,0.134808, 4, 'Cambridge School of Art'],
- ['Kettles yard', 52.210851,0.114637, 5, 'Kettles Yard'],
- ['Changing Spaces',52.199678,0.119931, 6, 'Changing Spaces'],
- ['Aid & Abet', 52.195218,0.136578, 7, 'Aid & Abet'],
- ['The Junction', 52.190756,0.136522, 8, 'The Junction']
- ];
- function setMarkers(map, markers) {
- for (var i = 0; i < markers.length; i++) {
- var sites = markers[i];
- var siteLatLng = new google.maps.LatLng(sites[1], sites[2]);
- var marker = new google.maps.Marker({
- position: siteLatLng,
- map: map,
- title: sites[0],
- zIndex: sites[3],
- html: sites[4],
- icon: "http://visualartscambridge.org/wp-content/uploads/2013/03/map-pin.png"
- });
- // Begin example code to get custom infobox
- var boxText = document.createElement("div");
- boxText.style.cssText = "border: 1px solid black; margin-top: 8px; background: yellow; padding: 5px;";
- boxText.innerHTML = marker.html;
- var myOptions = {
- content: boxText
- ,disableAutoPan: false
- ,maxWidth: 0
- ,pixelOffset: new google.maps.Size(-140, 0)
- ,zIndex: null
- ,boxStyle: {
- background: "url('http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/1.1.12/examples/tipbox.gif') no-repeat"
- ,opacity: 0.75
- ,width: "280px"
- }
- ,closeBoxMargin: "10px 2px 2px 2px"
- ,closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif"
- ,infoBoxClearance: new google.maps.Size(1, 1)
- ,isHidden: false
- ,pane: "floatPane"
- ,enableEventPropagation: false
- };
- // end example code for custom infobox
- var ib = new InfoBox(myOptions);
- google.maps.event.addListener(marker, "click", function (e) {
- // Added this extra line to call in content but now styles on infobox don't work????
- ib.setContent(this.html);
- ib.open(map, this);
- });
- }
- }
- google.maps.event.addDomListener(window, 'load', initialize);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement