Hi Allison,Craig had a great solution; here are a few more of the details that you were seeking.In default.htm, add the second set of code that he listed. I changed it a little by adding the CSS that you'll need and by removing the onClick specification--it's still needed, but for me, it was easier to link the click handler to the initial extent by setting the handler in the JavaScript.<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;">
In js/homePage.js, we'll insert the click handler: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
});
});
You can find these changes in the app's GitHub site; it's on a branch that's based on the version that you're using. The changed files are default.htm and homePage.js, and zoom.png icon was added. (It's just a 30x30 image; a sample is attached. The border comes from the +/- zoom control.)Thanks, Craig!As far as resources, I personally use (i.e., these are my recommendations and do not represent Esri)
- Esri's ArcGIS API for JavaScript Sandbox. Many of the JavaScript API samples have an "Explore in the sandbox" option, which not only gives you a working sample, but a try-it environment in which you can make changes and see what happens.
- The Dojo Toolkit online documentation. The tutorials get you started using Dojo, which, as you can see in the apps, we use heavily.
- w3schools. Good summary info for HTML, JavaScript, and CSS (sometimes you have to search for it--there's more on the site than meets the eye).
Regards,Mike