Google maps v3: syntax for changing mapType in click event

I have a Google v3 map initialized as ROADMAP, which I want to change to a HYBRID map for a specific click event processed by the jQuery function:

$('#cft').click(function() {
  map.setCenter($cft);
  map.setZoom(18);
  map.setMapType(HYBRID);
  return false;
});

When you click on a map of the latter and zoom as needed, but mapType remains ROADMAP, so this syntax does not work!

Is there a way like the one described above, or do I need to initialize a new card?

+3
source share
1 answer

try the following:

map.setMapTypeId(google.maps.MapTypeId.HYBRID);
+11
source

All Articles