1

I'm using ArcGIS API for JavaScript 3.13

The zoom out slide button is grayed out, however it works when clicked. Does anybody know how to make it not grayed out?

enter image description here

My map initialization code looks like this:

esri.config.defaults.map.zoomDuration = 0;  
esri.config.defaults.map.zoomRate = 0; 
_map = new Map("myMap", {
     center: [-100, 48],
     zoom: 3,
     basemap: "streets",
     minZoom: 3,
     navigationMode: "classic",
     logo: false
});

jsfiddle here: https://jsfiddle.net/xnqt6z37/7/

I figured out that it is the "minZoom" attribute that's making the zoomOut button grayed out. minZoom is set to be the same as initial zoom, so initially map cannot be zoomed out further.

Also,

esri.config.defaults.map.zoomDuration = 0; 
esri.config.defaults.map.zoomRate = 0;  

is causing the problem, I added these to remove zoom animation due to a bug in chrome, and zooming with ESRI arcgis: Zoom hangs ArcGIS API for JavaScript application?

I cannot find a setMinZoom() method in map, even though there is a getMinZoom().

I have this as a hacky workaround: https://jsfiddle.net/xnqt6z37/13/ it sets the initial zoom to be smaller than minZoom, then set zoom back to the desired initial zoom, which is the same as minZoom in this case.

Any better ways?

1

What you are doing is a good solution as it does not have the overhead of getting basemap tiles for the zoomLevel + 1 level. Alternatively you could override the CSS classes and set the levels to be same.

.esriSimpleSliderDisabledButton{
    background-color:#FFF;
    color:#57585A;
}

.esriSimpleSliderDisabledButton:hover{
    cursor:pointer;
    color:#57585A;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.