// if ( BrowserIsGMapsCompatible() ) { // function to create the marker and set up the event window function createMarker(map,html) { // Marker sizes are expressed as a Size of X,Y where the origin of the image // (0,0) is located in the top left of the image. // Origins, anchor positions and coordinates of the marker increase in the X // direction to the right and in the Y direction down. var map_center_obj = map.getCenter(); var image_shadow = { url: 'https://www.top10fresh.com/produce/reviews/skins/default/images/misc/gmaps_shadow_1.png', // This shadow marker is normally 71 pixels wide by 40 pixels high. size: new google.maps.Size(71, 40), // The origin for this image is (0, 0). origin: new google.maps.Point(0, 0), // The anchor for this image is the base normally at (43, 40). anchor: new google.maps.Point(43, 40) }; var image_main = { url: 'https://www.top10fresh.com/produce/reviews/google/icons/main/0/0.png', // This marker is normally 50 pixels wide by 40 pixels high. size: new google.maps.Size(50, 50), // The origin for this image is (0, 0). origin: new google.maps.Point(0, 0), // The anchor for this image is the base at (43, 40). anchor: new google.maps.Point(43, 40) }; var image_hover = { url: 'https://www.top10fresh.com/produce/reviews/google/icons/hover/0/0.png', // This marker is normally 50 pixels wide by 40 pixels high. size: new google.maps.Size(50, 50), // The origin for this image is (0, 0). origin: new google.maps.Point(0, 0), // The anchor for this image is the base normally at (43, 40). anchor: new google.maps.Point(43, 40) }; var marker_shadow = new google.maps.Marker({ position: map_center_obj, map: map, icon: image_shadow, zIndex: 1 }); // Shapes define the clickable region of the icon. The type defines an HTML // rect: coords is [x1,y1,x2,y2] where x1,y1 are the coordinates of the upper-left corner // of the rectangle and x2,y2 are the coordinates of the lower-right coordinates of the rectangle. var shape = { coords: [ 25, 0, 50, 50 ], type: 'rect' }; var marker_main = new google.maps.Marker({ position: map_center_obj, map: map, icon: image_main, shape: shape, title: 'Accardi Vineyards', zIndex: 100 }); // store the HTML so that the tooltip function can use it if (html) { var tooltipContentString = '
'+html+'
'; var infowindow = new google.maps.InfoWindow({ content: tooltipContentString, maxWidth: 400, pixelOffset: new google.maps.Size(15, 0) }); marker_main.addListener('click', function() { infowindow.open(map, marker_main); }); } // add marker "mouseover" and "mouseout" listeners marker_main.addListener('mouseover', function() { marker_main.setIcon(image_hover); // hover image on }); marker_main.addListener('mouseout', function() { marker_main.setIcon(image_main); // hover image off }); return } // create a map object with some controls let map; async function initMap() { // draw the map at specified location + zoom level const { Map } = await google.maps.importLibrary("maps"); const map_center_lat_lng = new google.maps.LatLng( 38.450291,-121.966843 ); map = new google.maps.Map(document.getElementById('map'), { center: map_center_lat_lng, zoom: 7, mapTypeControl: true, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU, // HORIZONTAL_BAR | DROPDOWN_MENU, mapTypeIds: ['roadmap','satellite','terrain','hybrid'] }, scaleControl: true, zoomControl: true, fullscreenControl: true, streetViewControl: true }); // add a marker with a mouseover window. wrap the text in the window. var tooltip_html = '' +'' +'' +'' +' ' +'' +' ' +' ' +'' +'' +'
' +' ' +' Accardi Vineyards' +'
' +' ' +' (707) 451-9516' +' ' +'
' +' 7924 Timm Rd.' +' ' +'
' +' Vacaville' +', 95688' +'
' +''; createMarker(map,tooltip_html); } initMap(); } //