0

Can you please take a look at This Demo and let me know how I can set up a custom home button

 var map;
 require(["esri/map", "esri/geometry/Point",
 "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol",
 "esri/graphic", "dojo/dom","dojo/on", "dojo/domReady!"], function (Map, Point,
 SimpleMarkerSymbol, SimpleLineSymbol,
 Graphic, dom, on) {
 map = new Map("map", {
 center: [0, 0],
 zoom: 5,
 basemap: "topo",
 slider: false, // set to false to remove default zoom buttons
 spatialReference: { wkid: 4326 }
 });
 on(dom.byId("zoomInBtn"), "click", function(evt){map.setZoom(map.getZoom()+1);});
 on(dom.byId("zoomOutBtn"), "click", function(evt){map.setZoom(map.getZoom()-1);});
 on(dom.byId("goHome"), "click", function(evt){});
 });
Evil Genius
6,2992 gold badges29 silver badges40 bronze badges
asked Sep 2, 2015 at 7:10

1 Answer 1

3

Your "goHome" function can just use the centerAndZoom function as described in the API documentation. So the code for your function procedure would be:

map.centerAndZoom([0,0],5);
answered Sep 2, 2015 at 13:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.