Hi everybody,
I have been learning ArcGIS for Javascript and trying to apply an example on using navigation toolbar. The problem is that icon of the buttons does not display. Even though firebug (I am using Aptana IDE + firebug for debugging) shows that the image of the background is downloaded. I have only tried to add one button which is the zoomin button. Could this be the problem? I do not think so.
Anybody could help?
Hi everybody,
I have been learning ArcGIS for Javascript and trying to apply an example on using navigation toolbar. The problem is that icon of the buttons does not display. Even though firebug (I am using Aptana IDE + firebug for debugging) shows that the image of the background is downloaded. I have only tried to add one button which is the zoomin button. Could this be the problem? I do not think so.
Anybody could help?
Here is the full page code. Please note that I am using the javascript esri and dojo libraries downloaded on the local server.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10">
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Navigation toolbar</title>
<style>
@import "http://js.arcgis.com/3.6/js/dojo/dijit/themes/claro/claro.css";
.zoominIcon { background-image:url(images/nav_zoomin.png); width:16px; height:16px; }
</style>
<link rel="stylesheet" type="text/css" href="http://132.35.22.9/arcgis_js_api/library/3.6/3.6/js/esri/css/esri.css" />
<link rel="stylesheet" type="text/css" href="http://132.35.22.9/arcgis_js_api/library/3.6/3.6/js/dojo/dijit/themes/claro/claro.css"/>
<script type="text/javascript" src="http://132.35.22.9/arcgis_js_api/library/3.6/3.6/init.js" ></script>
<script>var dojoConfig = { parseOnLoad:true };</script>
<script >
dojo.require("esri.map");
dojo.require("esri.toolbars.navigation");
dojo.require("dijit.form.Button");
dojo.require("dijit.Toolbar");
var map;
var navToolbar;
function init() {
var sr = new esri.SpatialReference({wkid:20438});
map = new esri.Map("mapDiv", {
spatialReference: sr
});
var imageParameters = new esri.layers.ImageParameters();
imageParameters.format = "jpeg"; //set the image type to PNG24, note default is PNG8.
//Takes a URL to a non cached map service.
var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://plngissalem/ArcGIS/rest/services/BI/MapServer", {
"opacity":0.5,
"imageParameters":imageParameters
});
navToolbar = new esri.toolbars.Navigation(map);
map.addLayer(dynamicMapServiceLayer);
}
dojo.ready(init);
</script>
</head>
<body >
<div id="navToolbar" data-dojo-type="dijit.Toolbar">
<div data-dojo-type="dijit.form.Button" id="zoomin" data-dojo-props="iconClass:'zoominIcon', onClick:function(){navToolbar.activate(esri.toolbars.Navigation.ZOOM_IN);}">Zoom In</div>
</div>
<div id="mapDiv" height="200" width="400">
</div>
</body>
</html>
At my end its displaying ( I am using online references)
Sample code : http://jsfiddle.net/Y6KUB/
You can try the following:
<div>
<img src="http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/demos/toolbars/images/nav_zoo..." id="zoomin" onclick="navToolbar.activate(esri.toolbars.Navigation.ZOOM_IN);" title="Zoom In"/>
</div>
replace the url of the src with your image.
Let me know if this helps.
<div> <img src="images/nav_zoomin.png" id="zoomin" onclick="navToolbar.activate(esri.toolbars.Navigation.ZOOM_IN);" title="Zoom In"/> </div>
check this....http://jsfiddle.net/patelmanya/Y6KUB/1/
is this what you looking for??
At my end its displaying ( I am using online references)
Sample code : http://jsfiddle.net/Y6KUB/
.zoominIcon { background-image:url(images/nav_zoomin.png); width:16px; height:16px; }
.zoominIcon { background-image:url(http://132.35.22.4/tempfiles/images/nav_zoomin.png); width:16px; height:16px; }