<!DOCTYPE html> <html> <head> <title>Create a Map</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/esri/css/esri.css"> <style> html, body, #mapDiv { padding: 0; margin: 0; height: 100%; } .esriSimpleSliderHomeButton{ border-bottom: 2px solid #666666; background-image: url(../../forum/images/home.png); background-repeat:no-repeat; background-position:center; } </style> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/"></script> <script> dojo.require("esri.map"); var initExtent; function init(){ var map = new esri.Map("mapDiv", { center: [-56.049, 38.485], zoom: 3, basemap: "streets" }); //when the map's loaded add the new button to the slider. dojo.connect(map,"onLoad",function(){ var initExtent = map.extent; dojo.create("div",{ className: "esriSimpleSliderHomeButton", onclick: function(){ map.setExtent(initExtent); } },dojo.query(".esriSimpleSliderIncrementButton")[0], "after"); }); } dojo.ready(init); </script> </head> <body class="claro"> <div id="mapDiv"></div> </body> </html>
theZoomDiv = dojo.create("div", { id: "sliderZoomHomeBtn", innerHTML: "<img style=\"width:24px;height:24px;margin:0 auto;padding-top:3px\" src=\"images/zoomHome.png\">" },"map_zoom_slider"); dojo.addClass(theZoomDiv, "esriSimpleSliderIncrementButton");
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.