Select to view content in your preferred language

{isZoomSlider: false} fails with default sliderStyle

2267
4
01-27-2013 10:35 AM
StephenLead
Honored Contributor
Here's a minor bug introduced at 3.3. The new zoomSlider style is actually +/- buttons rather than a slider.

If you simply specify {isZoomSlider: false} the buttons are still shown. You need to specify {isZoomSlider: false, sliderStyle: "large" for the buttons to be removed.

It seems that if isZoomSlider is false, none of the zoom controls should be shown (eg, you don't want to allow zooming, or you're controlling it yourself).

Cheers,
Steve
0 Kudos
4 Replies
KellyHutchins
Esri Notable Contributor
Instead of using the map property isZoomSlider you can use the map's constructor option of slider:

        map = new esri.Map("map", {
          slider:false,
          basemap: "streets",
          center: [-0.136, 51.510],
          zoom: 15
        });



Alternatively you can use the map's hideZoomSlider method to show/hide the slider after map creation:

        dojo.connect(map, "onLoad", function(){
            map.hideZoomSlider();
        });

0 Kudos
ScottSteigerwald
Occasional Contributor
Instead of using the map property isZoomSlider you can use the map's constructor option of slider:

Alternatively you can use the map's hideZoomSlider method to show/hide the slider after map creation:

        dojo.connect(map, "onLoad", function(){
            map.hideZoomSlider();
        });



This does not work.  The map still displays the zoom slider after the map is loaded, even with this code.  I'm assuming the order of events if overriding the behavior.  When is the zoom slider shown/added?  After all layers have been added?  What is the order of events?
0 Kudos
JonathanUihlein
Esri Regular Contributor
map.on("load", function(){map.hideZoomSlider();});


Works for me.

Sample here:

http://jsfiddle.net/WrQe4/
0 Kudos
ferferferf
Deactivated User
But if you add sliderStyle: "large", to your code the slider is displayed and it shouldn`t, so it is a bug:

    
        map = new Map("mapDiv", {
        center: [-56.049, 38.485], //longitude, latitude
        zoom: 3,
        sliderStyle: "large",
        basemap: "streets",
        slider: true, //default
 sliderPosition: "top-left" //default
       
    });



map.on("load", function(){map.hideZoomSlider();});


Works for me.

Sample here:

http://jsfiddle.net/WrQe4/
0 Kudos