Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

247
Views
How to add remove zoomControl on google map base on size

I saw an the website of google that we could add/remove the zoomControl base on the map size. But the page doesn't explain how to do this.

My objective would be to remove the zoom control on smartphone, so under 576px I would like the zoom control to be hidden.

I'm working with angular but do not wish to subscribe to the screen size, but would like to let google do that on his self.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Google map doesn't accept such variable, but it's mentioned that the control will be hidden at 200px width, and to disable this you should explicitly mention it.

So if you wish to do that, you'll have to go with a little bit of javascript.

First check the screen width of device then set zoomControl property based on that. For example:-

function initMap(): void {
  let zoomControl = true;
  if(window.innerWidth < 576) zoomControl = false;
  const map = new google.maps.Map(
    document.getElementById("map") as HTMLElement,
    {
      zoom: 4,
      center: { lat: -33, lng: 151 },
      zoomControl: zoomControl,
      scaleControl: true,
    }
  );
}

declare global {
  interface Window {
    initMap: () => void;
  }
}
window.initMap = initMap;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!