<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Locate Button and WebID</title> <link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.9/js/esri/css/esri.css"> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; } #LocateButton { position: absolute; top: 95px; left: 20px; z-index: 50; } </style> <script src="//js.arcgis.com/3.9/"></script> <script> var map var geoLocate require([ "esri/map", "esri/arcgis/utils", "esri/dijit/LocateButton", "dojo/domReady!" ], function (Map, arcgisUtils, LocateButton) { arcgisUtils.createMap("4778fee6371d4e83a22786029f30c7e1", "mapDiv").then(function (response) { map = response.map }); geoLocate = new LocateButton({ map: mapDiv, scale: 11, useTracking: true }, "LocateButton"); geoLocate.startup(); }); </script> </head> <body> <div id="mapDiv" class="map"> <div id="LocateButton"></div> </div> </body> </html>
Solved! Go to Solution.
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Locate Button and WebID</title> <link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.9/js/esri/css/esri.css"> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; } #LocateButton { position: absolute; top: 95px; left: 20px; z-index: 50; } </style> <script src="//js.arcgis.com/3.9/"></script> <script> var geoLocate; require([ "dojo/parser", "dojo/ready", "esri/map", "esri/arcgis/utils", "esri/dijit/LocateButton", "dojo/domReady!" ], function (parser, ready, Map, arcgisUtils, LocateButton) { //create a map and instance of geoLocator and other widgets here ready(function(){ parser.parse(); { arcgisUtils.createMap("4778fee6371d4e83a22786029f30c7e1", "mapDiv").then(function (response) { var actualmap = response.map; geoLocate = new LocateButton({ map: actualmap, scale: 11, useTracking: true }, "LocateButton"); geoLocate.startup(); }); }})}); </script> </head> <body> <div id="mapDiv" class="map"> <div id="LocateButton"></div> </div> </body> </html>
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Locate Button and WebID</title> <link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.9/js/esri/css/esri.css"> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; } #LocateButton { position: absolute; top: 95px; left: 20px; z-index: 50; } </style> <script src="//js.arcgis.com/3.9/"></script> <script> var geoLocate; require([ "dojo/parser", "dojo/ready", "esri/map", "esri/arcgis/utils", "esri/dijit/LocateButton", "dojo/domReady!" ], function (parser, ready, Map, arcgisUtils, LocateButton) { //create a map and instance of geoLocator and other widgets here ready(function(){ parser.parse(); { arcgisUtils.createMap("4778fee6371d4e83a22786029f30c7e1", "mapDiv").then(function (response) { var actualmap = response.map; geoLocate = new LocateButton({ map: actualmap, scale: 11, useTracking: true }, "LocateButton"); geoLocate.startup(); }); }})}); </script> </head> <body> <div id="mapDiv" class="map"> <div id="LocateButton"></div> </div> </body> </html>