Created
July 21, 2016 07:06
-
-
Save kirandash/f6b5e188d5f504466192e9a46e8dd5d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add_marker( $marker, map ) { | |
// var | |
var latlng = new google.maps.LatLng( $marker.attr('data-lat'), $marker.attr('data-lng') ); | |
// create marker | |
var marker = new google.maps.Marker({ | |
position : latlng, | |
map : map, | |
icon: "http://de-vos.nl//wp-content/themes/devos/img/mapMarker.png" | |
}); | |
// add to array | |
map.markers.push( marker ); | |
// if marker contains HTML, add it to an infoWindow | |
if( $marker.html() ) | |
{ | |
// create info window | |
var infowindow = new google.maps.InfoWindow({ | |
content : $marker.html() | |
}); | |
// show info window when marker is clicked | |
google.maps.event.addListener(marker, 'click', function() { | |
infowindow.open( map, marker ); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment