var devPlanLayer = new esri.layers.FeatureLayer(devPlanLayerURL, {
mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
outFields: ["*"],
id: devPlanLayerID,
displayOnPan: false
});dojo.connect(devPlanLayer, "onMouseMove", function (evt) {
if (evt.graphic) {
if (evt.graphic.attributes) {
ShowMapTip(evt, evt.graphic.attributes.NAME);
}
}
});
dojo.connect(devPlanLayer, "onMouseOut", CloseMapTip);//function to show maptip
function ShowMapTip(evtArgs, content) {
CloseMapTip();
var dialog = new dijit.TooltipDialog({
id: "toolTipDialog",
content: '<span style="font-size:11px; font-family:Verdana;">' + content + '</span> ',
style: "position: absolute; z-index:1000;"
});
dialog.startup();
dojo.style(dialog.domNode, "opacity", 0.80);
dijit.placeOnScreen(dialog.domNode, { x: evtArgs.pageX, y: evtArgs.pageY }, ["BL", "BR"], { x: 5, y: 5 });
}
//function to close maptip
function CloseMapTip() {
if (dijit.byId('toolTipDialog')) {
dijit.byId('toolTipDialog').destroy();
}
}
//URL used for doing query task on the features. 'DevPlanLayer' : "http://servername/arcgis/rest/services/foldername/servicename/MapServer/0",
devPlanLayerURL = responseObject.DevPlanLayer;
//URL used for doing query task on the features. 'DevPlanLayer' : "https://myserver/arcgis/rest/services/myfolder/Parks/MapServer/0",
dojo.connect(devPlanLayer, "onMouseMove", function (evt) {
if (evt.graphic) {
if (evt.graphic.attributes) {
ShowMapTip(evt, evt.graphic.attributes.NAME);
}
}
});
dojo.connect(devPlanLayer, "onMouseOut", CloseMapTip);
var devPlanLayer = new esri.layers.FeatureLayer(devPlanLayerURL, {
mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
outFields: ["*"],
id: devPlanLayerID,
displayOnPan: false
});map.addLayer(devPlanLayer);
They way i got this to work was by adding the above code and :
dojo.require("dijit.TooltipDialog");
In the homepage.js on line 30.
The css then needs to change because the text is white.
The easiest way is to set a background color
.dijitTooltipContainer {
background-color: #2F4A24 !important;
}