javascript - Function use value in link when available -


I am unsure how to explain it correctly, but I basically marker via Google API on a map Link to them on the instructions of that place, however, currently it only works if the user allows to track their location.

What I have to do is basically in both situations, to mark markers where the user tracks his location

var reittiohjeet = "" + pos + "/"

And if the user dismisses the track to track their location, then the link

var reittiohjeet2 = " "+ Osoite;

I tried to make alternate functions that would be participating in the second section of the Navigator.jolocation but nothing like this looks like.

 < Code> funct Ion initialize () {var mapOptions = {center: new google.maps.LatLng (60.174,24.927), zoom: 8} Var map = new google.maps.Map (document.getElementById ("map-canvas"), map options ); If (navigator.jolocation) {navigator.geolocation.getCurrentPosition (function) {var pos = new google.maps.LatLng (position.coords.latitude, position.coords.longitude); // Luo marker var image = 'User -location.png'; var userMarker = new google.maps.marker ({status: position, map: map, icon: image}); map.setCenter (pos); Set markers (map, shops, status);}, function () {handle nozzolocation (true);}); } And {handle handle (wrong);}} function set marker (map, position, position) {for (var i = 0; i & lt; locations.length; i ++) {var store = places [i]; var MyLatLng = new google.maps.LatLng (store [1], shop [2]); var nimi = store [0]; var osoite = store [5]; var puhelinnumero = store [3]; var workkosive = store [4] ]; Var reittiohjeet = "https://www.google.fi/maps/dir/"+pos+"/"+osoite; Var content =" & lt; div class = 'content' & gt; & lt; h3 & Gt; "+ Nimi +" & lt; / h3 & gt; & lt; strong & gt; osome: & lt; / strong & gt; "+ osoite +" 
strong & Gt; pixilanero: & lt; / strong & gt; "+ puhelinnumero +"
Workcoceau ु: & lt; / strong & gt; & lt; a href = '"+ verkkosivu +"' target = '_ blank' & gt; + + + Verkkosivu + "& lt; / a & gt; & lt; br / & Lt; br / & gt; & lt; a href = '"+ reittiohjeet +"'> gt;
"Var marker = new Google.maps.marker ({status: myLatLng, map: map, title: store [0]}); Var infowindow = new google.maps.InfoWindow () google.maps.event.addListener (marker, 'click', (function (marker, content, infowindow) {return function () {infowindow.setContent (content); infowindow.open (Map, marker);}}}) (marker, content, infondo)); }}

Details given in the other statement will only be executed when the browser does < / P>

Note: This will not happen in Firefox.

Do the required work, see:


Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -