javascript - Map isn't loading on Cordova -


i have code google maps, in emulator see yellow pegman icon. else grey , map isn't loading.

function onload() {         document.addeventlistener("deviceready", ondeviceready, false);     }     function ondeviceready() {      }  var map; function initialize() {       var mapoptions = {     zoom: 14     };      map = new google.maps.map(document.getelementbyid('map-canvas'),       mapoptions);     // try html5 geolocation   if(navigator.geolocation) {     navigator.geolocation.getcurrentposition(function(position) {       var pos = new google.maps.latlng(position.coords.latitude,                                        position.coords.longitude);          var infowindow = new google.maps.infowindow({           content: 'contentstring'        });           var marker1 = new google.maps.marker({            position: pos,            map: map,            title: 'ciao!'       });       google.maps.event.addlistener(marker1, 'click', function() {     infowindow.open(map,marker1);     });       var marker2 = new google.maps.marker({            position: new google.maps.latlng( 45.4353135, 12.135795400000006 ),            map: map,            title: 'ciao!'       });           map.setcenter(pos);     }, function() {       handlenogeolocation(true);     });   } else {     // browser doesn't support geolocation     handlenogeolocation(false);   } }  function handlenogeolocation(errorflag) {   if (errorflag) {     var content = 'error: geolocation service failed.';   } else {     var content = 'error: browser doesn\'t support geolocation.';   }    var options = {     map: map,     position: new google.maps.latlng(60, 105),     content: content   };    var infowindow = new google.maps.infowindow(options);   map.setcenter(options.position); } google.maps.event.adddomlistener(window, 'load', initialize); 

also, how can change marker icon? can't seem work currently.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -