Display Google Map on screen load
How can I display a Google Map with my location when the screen loads? I can do it when I press a "Button", but I cant make the map load when screen loads.
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
How can I display a Google Map with my location when the screen loads? I can do it when I press a "Button", but I cant make the map load when screen loads.
Hello,
Let's try to use "Page show" event instead of "Load"
Hi.
I've changed the event to "Page Show" but it still doesnt load the map.
Here is the code I use for "Page Show" event:
---------------------------------------------------------Appery('lat').text(localStorage.getItem('latitude'));
Appery('lng').text(localStorage.getItem('longitude'));
var map = Appery('map');
map.options['latitude'] = localStorage.getItem('latitude');
map.options['longitude'] = localStorage.getItem('longitude');
map.refresh();
Here is the link:
http://appery.io/app/mobile-frame?src...
Please use the following code on page show eventprevar myLat = localStorage.getItem('latitude');
var myLong = localStorage.getItem('longitude');
var mapOptions = {
center: new google.maps.LatLng(myLat, myLong),
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);/prereplace map-canvas with screenName_mapName
where screenName - screen name, mapName - map component name
Thank you Maryna, it works perfectly now.