Skip to content

Instantly share code, notes, and snippets.

@getsudocode
getsudocode / color_marker.html
Last active December 10, 2020 02:37
change javascript google map marker color
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
#map {
height: 100%;
}
html, body {
height: 100%;
@getsudocode
getsudocode / color_marker_function.js
Last active July 19, 2018 12:26
change JavaScript Google Map marker color
let map;
// global array to store the marker object
let markersArray = [];
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
addMarker({lat: -34.297, lng: 150.544}, "yellow");
let map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
let marker = new google.maps.Marker({
map: map,
position: {lat: -34.397, lng: 150.644},
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
#map {
height: 100%;
}
html, body {
height: 100%;
function addMarker(latLng) {
let marker = new google.maps.Marker({
map: map,
position: latLng,
draggable: true
});
// add listener to redraw the polyline when markers position change
marker.addListener('position_changed', function() {
drawPolyline();
let map;
let markersArray = [];
// define global variable to store polyline
let polyline = null;
function initMap() {
...
map.addListener('click', function(e) {
//console.log(e);
addMarker(e.latLng);
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
map.addListener('click', function(e) {
console.log(e);
addMarker(e.latLng);
});
<script>
let map;
// define global array to store markers added
let markersArray = [];
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
#map {
height: 100%;
}
html, body {
height: 100%;
@getsudocode
getsudocode / post.hbs
Last active July 10, 2018 07:45
Ghost part of post.hbs to add Disqus embed code
<footer class="post-full-footer">
 …
</footer>
 <section class="post-full-comments">
 {{! - Add disqus Universal Embed Code here - }}
 </section>
</article>