diff options
author | schuster-rainer <rainerschuster79@gmail.com> | 2017-03-01 00:31:19 +0300 |
---|---|---|
committer | Adrián Moreno <adrian@morenomartinez.com> | 2017-03-09 14:29:04 +0300 |
commit | 3943a0fbb9a665b0f6d8b71cb3cac11ac44ac0c7 (patch) | |
tree | 3760e5d70e7aa108eb09a86263c8f6510e9e87f3 /static | |
parent | 15526a60fa71c2990236053456529c02783558ca (diff) |
Added directions for gmaps on pin click
When the direction attribute is used in the config the
given address is used for directions instead of
long and lat
Diffstat (limited to 'static')
-rw-r--r-- | static/js/gmaps.init.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/static/js/gmaps.init.js b/static/js/gmaps.init.js index 7bf4b49..4790ee9 100644 --- a/static/js/gmaps.init.js +++ b/static/js/gmaps.init.js @@ -8,6 +8,7 @@ function map () { if ($('#map').length) { var lat = $('#gmap-lat').val() var lng = $('#gmap-lng').val() + var direction = $('#gmap-dir').val() var image = '/img/marker.png' var styles = @@ -54,8 +55,14 @@ function map () { map.addMarker({ lat: lat, lng: lng, - icon: image /* , - title: '', + icon: image, + click: function(e) { + // when we get an address with spaces ... + url = "https://maps.google.com?daddr=" + direction.split("match").join("replace"); + window.open(url,'_blank'); + }, + title: direction, + /* , infoWindow: { content: '<p>HTML Content</p>' } */ |