8

Is there a way to hide the zoom-in/zoom-out buttons in ArcGIS javascript API? I have external zoom buttons elsewhere on the page, so these are no longer needed.

screenshot

Dr. Greenthumb
  • 277
  • 4
  • 8

4 Answers4

6

Pass in slider: false as an option when creating the map. Here is the Map Options API Reference.

map = new Map("map", {
    basemap: "streets",                 
    slider: false
}
James Lawruk
  • 941
  • 6
  • 9
4

I did it with:

on(map, "load", function () {
        map.hideZoomSlider();
    });
Branco
  • 3,201
  • 1
  • 18
  • 37
  • Of course assuming you're sticking with the standard variable names from the samples... ie. on and map. – Branco Jul 18 '14 at 16:03
2

For anyone trying to accomplish this using the 4.x versions of the API, try the following when using the MapView (or SceneView) constructor:

var view = new MapView ({
    container: "viewDiv",
    map: map,
    ui: {
        components: [ "attribution" ]
    }
});

Source: https://developers.arcgis.com/javascript/latest/sample-code/view-disable-zoom/index.html

Marcelo Villa
  • 5,928
  • 2
  • 19
  • 38
1

I believe you need to use method's showZoomSlider() / hideZoomSlider() property isZoomSlider. This should show or hide the zoom slider on the map.

Help link here. Examples of disabling here.

Alex Tereshenkov
  • 29,912
  • 4
  • 54
  • 119