ciccio
Posts: 0
Joined: Fri Jun 14, 2013 10:40 am

problems with google maps directions and map centering

i undone every change in JQM source files, but the problem is still the same (on the first click on the map button the panel is opened with a map neither zoomed no centered correctly, on the second click on the same button the map is centered and zoomed in the right way)

Oleg Danchenkov
Posts: 0
Joined: Tue Apr 30, 2013 5:51 pm

problems with google maps directions and map centering

Hi.
Probably map is not ready when you try to resize it. Try to use timeout before displayDirections function call.
Try this code on butt_map2 click event
precodefunction showDirections(){
var id_itinerario =localStorage.getItem('id_strada');
if (id_itinerario == "11"){
var sourceAddress = "Cosenza&quot
var destinationAddress = "Castrovillari, CS&quot
var waypoint = "Cassano allo ionio, CS&quot
}

Code: Select all

 if (id_itinerario == "13"){ 
     var sourceAddress = "Rossano&quot 
     var destinationAddress = "nova siri&quot 
     var waypoint = "cassano allo ionio&quot 
 } 
 displayDirections(sourceAddress, destinationAddress, waypoint); 

}
setTimeout(showDirections, 1000);
/code/pre

ciccio
Posts: 0
Joined: Fri Jun 14, 2013 10:40 am

problems with google maps directions and map centering

thanks. it works

Return to “Issues”