Last active
August 29, 2015 14:10
-
-
Save jmcelroy5/5310653aa393f6531e63 to your computer and use it in GitHub Desktop.
Change map marker color when listing is clicked
This file contains 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
Map.prototype.toggleMarkerColor = function(listingId){ // this is not running | |
alert("The map heard the click event!"); | |
var idx = this.markerMap[listingId]; | |
this.geoJson[idx].properties["marker-color"] = "#ffffff"; | |
this.markerLayer.setGeoJson(this.geoJson); | |
this.markerLayer.addTo(this.map); | |
}; | |
// Under Listings view... | |
$("li.listing-link").on('click', function(){ | |
var listingId = $(this).data('id'); | |
Map.toggleMarkerColor(listingId); // Uncaught TypeError: undefined is not a function | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment