Generate Google Maps with dynamic values of latitude and longitude in javaScript -


i gone through many tutorials , google developer site, everywhere way create google maps particular latitude/longitude given.e.g.

function initialize() {     var mapoptions = {         center: {             lat: -34.397,             lng: 150.644         },         zoom: 8     };     var map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); }  google.maps.event.adddomlistener(window, 'load', initialize); 

does know javascript code create map based on dynamic values lat/long? mean not specific values -34.397 etc. function initialize pass latitude , longitude arguments , generate map. can please tell me how it?

if you're going pass in values lat/lng arguments initialize function couldn't do:

function initialize(lat, lng) {     var mapoptions = {       center: { lat: lat, lng: lng},       zoom: 8     };     var map = new google.maps.map(document.getelementbyid('map-canvas'),         mapoptions);   }   google.maps.event.adddomlistener(window, 'load', initialize.bind(null, <lat>, <lng>)); 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -