function zoomExtent() { map.setExtent(startExtent); //here set your extent you wish to zoom back to, either calling the xmin, ymin, xmax, ymax or by calling the original extent variable }
<!--Zoom to Extent--> <div id="zoom" title="Zoom to Full Extent" ;> <img src="images/zoom.png" onClick="zoomExtent();"> </div>
<body onorientationchange="orientationChanged();"> <div id="divMainContainer" style="width: 100%; height: 100%;" dojotype="dojox.mobile.View" selected="true"> <div id="map" style="width: 100%; height: 100%;"> </div> </div> <!--Zoom to Extent--> <div id="zoom" title="Zoom to Full Extent" class="esriSimpleSlider" style="top:155px!important"> <img src="images/zoom.png"> </div> <div id="divSplashScreenContainer" class="divSplashScreenContainer" style="display: none;">
dojo.connect(map, "onLoad", function () { var zoomExtent; var extent = GetQuerystring('extent'); if (extent != "") { zoomExtent = extent.split(','); } else { zoomExtent = responseObject.DefaultExtent.split(","); } var startExtent = new esri.geometry.Extent(parseFloat(zoomExtent[0]), parseFloat(zoomExtent[1]), parseFloat(zoomExtent[2]), parseFloat(zoomExtent[3]), map.spatialReference); map.setExtent(startExtent); MapInitFunction(); dojo.connect(dojo.byId("zoom"), "onclick", function () { map.setExtent(startExtent); //here set your extent you wish to zoom back to, either calling the xmin, ymin, xmax, ymax or by calling the original extent variable }); });
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.