Created
February 5, 2019 22:26
-
-
Save 2Fwebd/5d4dc5e2a8ddb448c87e0a429aab7654 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
/** | |
* Draw the marker of the members on the map | |
* | |
* So we can see them | |
*/ | |
drawMarkers: function() { | |
var self = this; | |
var infowindow = new google.maps.InfoWindow(); | |
// We loop through the members | |
for (var i = 0; i < this.members.length; i++) { | |
var memberLocation = this.members[i]; | |
var marker = new google.maps.Marker({ | |
position: new google.maps.LatLng( | |
parseFloat(memberLocation.lat), | |
parseFloat(memberLocation.long) | |
), | |
map: self.mapObject | |
}); | |
var htmlContent = ''; | |
htmlContent += '<div class="text-center">'; | |
htmlContent += '<img src="'+ memberLocation.avatar_url +'" class="w-50 rounded rounded-circle">'; | |
htmlContent += '<h3 class="d-block mb-0 mt-2">'+ memberLocation.user_info.data.display_name +'</h3>'; | |
htmlContent += '<i>'+ memberLocation.user_info.data.user_email +'</i>'; | |
htmlContent += '</div>'; | |
google.maps.event.addListener(marker, 'click', (function(marker) { | |
return function() { | |
infowindow.setContent(htmlContent); | |
infowindow.open(self.mapObject, marker); | |
} | |
})(marker)); | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment