Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to show/hide all the UI controls from google map after initialised?

There is an option on Google Maps disableDefaultUI set to false before loading google Maps.

function initMap(){ 
var mapVar = new google.maps.Map(document.getElementById('map'), {
    zoom: 4,
    center: {lat: -33, lng: 151},
    disableDefaultUI: true
  });
  }

Is there any way to hide all the controls using my mapVar variable once the map is rendered?

Removing all controls from a google map - This question is about hiding the map on load.

like image 740
kishorekumaru Avatar asked Oct 25 '25 01:10

kishorekumaru


1 Answers

There is a method to hide controls dynamically.

mapVar.setOptions({disableDefaultUI:true});

In case if we want to hide a single option mapVar.setOptions({zoomControl:false});

like image 70
kishorekumaru Avatar answered Oct 27 '25 15:10

kishorekumaru