Hi all,The question is how to add a button to the JavaScript Basic Viewer:http://www.arcgis.com/apps/OnePane/basicviewer/index.htmlMore specifically how to add the Home Button:https://developers.arcgis.com/en/javascript/jssamples/widget_home.htmlThis is how I added the button:From the sample https://developers.arcgis.com/en/javascript/jssamples/widget_home.html copy/paste the description of HomeButton Into the file: ..\css\layout.css #HomeButton {
position: absolute;
top: 95px;
left: 20px;
z-index: 50;
}
Then copy/paste the tag "HomeButton" into index.html file
<div id="HomeButton"></div>
inside the Map Section<!-- Map Section -->
<div id="map" data-dojo-type="dijit.layout.ContentPane" data-dojo-props='region:"center"' dir="ltr">
<div id="HomeButton" class="HomeButton"></div>
<div id="logo" class="logo" style="display:none;">
<!--If a logo is specified in config section then the logo will be added
to the map-->
</div>
<!--Floating window that contains the measure dijit-->
<div id="floater">
<div id="measureDiv"></div>
</div>
<!--Floating window contains the time slider-->
<div id="timeFloater" style='display:none;'>
</div>
</div>
Then declare the object HomeButton in the file ..\javascript\layout.jsdojo.require("esri.dijit.HomeButton");
var homeButton;
�?�
dojo.connect(dijit.byId('map'), 'resize', resizeMap);
adjustPopupSize();
var layers = response.itemInfo.itemData.operationalLayers;
//constrain the extent
if (configOptions.constrainmapextent) {
var basemapExtent = map.getLayer(map.layerIds[0]).fullExtent.expand(1.5);
//create a graphic with a hole over the web map's extent. This hole will allow
//the web map to appear and hides the rest of the map to limit the visible extent to the webmap.
var clipPoly = new esri.geometry.Polygon(map.spatialReference);
clipPoly.addRing([
[basemapExtent.xmin, basemapExtent.ymin],
[basemapExtent.xmin, basemapExtent.ymax],
[basemapExtent.xmax, basemapExtent.ymax],
[basemapExtent.xmax, basemapExtent.ymin],
[basemapExtent.xmin, basemapExtent.ymin]
]);
//counter-clockwise to add a hole
clipPoly.addRing([
[webmapExtent.xmin, webmapExtent.ymin],
[webmapExtent.xmax, webmapExtent.ymin],
[webmapExtent.xmax, webmapExtent.ymax],
[webmapExtent.xmin, webmapExtent.ymax],
[webmapExtent.xmin, webmapExtent.ymin]
]);
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(), new dojo.Color("white"));
var maxExtentGraphic = new esri.Graphic(clipPoly, symbol);
map.graphics.add(maxExtentGraphic);
}
// Add Home button
homeButton = new esri.dijit.HomeButton({
map: map,
id: 'HomeButton'
}, 'HomeButton');
homeButton.startup();
�?�.
Done! the button now is visible.