Add multiple points of interest on Google Map -
i have nice script allows me have 1 point of interest on google map, need more poi (+- 15)
could me adapt script enable multiple locations easily? frankly don't see yet have (as newbie in code) i'm willing switch other code style has been added code.
google.map = function(){ if($('.map').length > 0) { $('.map').each(function(i,e){ $map = $(e); $map_id = $map.attr('id'); $map_lat = $map.attr('data-maplat'); $map_lon = $map.attr('data-maplon'); $map_zoom = parseint($map.attr('data-mapzoom')); $map_title = $map.attr('data-maptitle'); var latlng = new google.maps.latlng($map_lat, $map_lon); var options = { scrollwheel: false, draggable: false, zoomcontrol: false, disabledoubleclickzoom: false, disabledefaultui: true, zoom: $map_zoom, center: latlng, maptypeid: google.maps.maptypeid.roadmap }; var styles = [ { stylers: [ { hue: "#78dd3e" }, { saturation: -100 } ] }, { featuretype: "road", elementtype: "geometry", stylers: [ { lightness: 100 }, { visibility: "simplified" } ] }, { featuretype: "road", elementtype: "labels", stylers: [ { visibility: "off" } ] } ]; var styledmap = new google.maps.styledmaptype(styles,{name: "styled map"}); var map = new google.maps.map(document.getelementbyid($map_id), options); var image = '_include/img/marker.png'; var marker = new google.maps.marker({ position: latlng, map: map, title: $map_title, icon: image }); map.maptypes.set('map_style', styledmap); map.setmaptypeid('map_style'); var contentstring = '<p><strong>light falls</strong><br></p>'; var infowindow = new google.maps.infowindow({ content: contentstring }); google.maps.event.addlistener(marker, 'click', function() { infowindow.open(map,marker); }); }); } }
thanks!
Comments
Post a Comment