<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" /> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/> <title>Navigation toolbar</title> <style type="text/css"> @import "http://serverapi.arcgisonline.com/jsapi/arcgis/2.6/js/dojo/dijit/themes/claro/claro.css"; .zoominIcon { background-image:url(images/nav_zoomin.png); width:16px; height:16px; } </style> <script type="text/javascript">dojoConfig = { parseOnLoad:true }</script> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.6"></script> <script type="text/javascript"> dojo.require("esri.map"); dojo.require("esri.toolbars.navigation"); dojo.require("dijit.form.Button"); var map, navToolbar; function init() { esri.config.defaults.map.sliderLabel = null; var startExtent = new esri.geometry.Extent({"xmin":-16358747,"ymin":2847778,"xmax":3678761,"ymax":12866532,"spatialReference":{"wkid":102100}}); map = new esri.Map("map",{extent:startExtent}); map.addLayer(new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer")); navToolbar = new esri.toolbars.Navigation(map); dojo.connect(navToolbar, "onExtentHistoryChange", function(){ navToolbar.deactivate(); }); } dojo.addOnLoad(init); </script> </head> <body class="claro"> <div data-dojo-type="dijit.form.Button" id="zoomin" data-dojo-props="iconClass:'zoominIcon', onClick:function(){navToolbar.activate(esri.toolbars.Navigation.ZOOM_IN);}">Zoom In</div> <div id="map" style="width:1024px; height:512px; border:1px solid #000;"></div> </body> </html>
I really don't want the whole nav bar; I have my own nav bar which works for my application and just want to add this one function. Is there a way to do this without the nav bar?
<bodyclass="claro"> <divid="navToolbar"data-dojo-type="dijit.Toolbar"> <divdata-dojo-type="dijit.form.Button"id="zoomin"data-dojo-props="iconClass:'zoominIcon', onClick:function( {navToolbar.activate(esri.toolbars.Navigation.ZOOM_IN);}">Zoom In</div> <!-- <divdata-dojo-type="dijit.form.Button"id="zoomout"data-dojo-props="iconClass:'zoomoutIcon', onClick:function(){navToolbar.activate(esri.toolbars.Navigation.ZOOM_OUT);}">Zoom Out</div>-->
So I've decided to eliminate the state dropdown and replace it with a zoom box button (probably a magnifying glass or something similar). When the user clicks on this button, I want it to result in a one-time zoom via the zoom box.
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.