Toggle div Visibility for Visible Layers

647
1
Jump to solution
03-13-2014 05:44 AM
WesAskew
New Contributor II
I am trying to toggle the visibility of a particular div container when certain layers are visible.  I am using the table of contents widget to toggle layer visibility from the following link:  http://www.arcgis.com/home/item.html?id=9b6280a6bfb0430f8d1ebc969276b109.  I have the identify task working properly for the visible layers using the following code and I think that I need to do something similar to get the visible layer name, however, I cannot seem to modify it to work for toggling the div visibility:
var deferred = identifyTask.execute(identifyParams); deferred.addCallback(function(response){      return dojo.map(response, function(result){      var feature=result.feature;      feature.attributes.layerName = result.layerName;         var template = new esri.InfoTemplate("${Name}", "${*}");      feature.setInfoTemplate(template);      return feature;      }); });      map.infoWindow.setFeatures([deferred]); map.infoWindow.show(evt.mapPoint);


Could someone please provide guidance on how I can go about this?  Thanks in advance.
0 Kudos
1 Solution

Accepted Solutions
WesleyAskew
New Contributor III
I am trying to toggle the visibility of a particular div container when certain layers are visible.  I am using the table of contents widget to toggle layer visibility from the following link:  http://www.arcgis.com/home/item.html?id=9b6280a6bfb0430f8d1ebc969276b109.  I have the identify task working properly for the visible layers using the following code and I think that I need to do something similar to get the visible layer name, however, I cannot seem to modify it to work for toggling the div visibility:
var deferred = identifyTask.execute(identifyParams); deferred.addCallback(function(response){      return dojo.map(response, function(result){      var feature=result.feature;      feature.attributes.layerName = result.layerName;         var template = new esri.InfoTemplate("${Name}", "${*}");      feature.setInfoTemplate(template);      return feature;      }); });      map.infoWindow.setFeatures([deferred]); map.infoWindow.show(evt.mapPoint);


Could someone please provide guidance on how I can go about this?  Thanks in advance.


if (layer.visibleLayers =='layerid'){
   dojo.byId("dib").style.display = 'none';
  }

View solution in original post

0 Kudos
1 Reply
WesleyAskew
New Contributor III
I am trying to toggle the visibility of a particular div container when certain layers are visible.  I am using the table of contents widget to toggle layer visibility from the following link:  http://www.arcgis.com/home/item.html?id=9b6280a6bfb0430f8d1ebc969276b109.  I have the identify task working properly for the visible layers using the following code and I think that I need to do something similar to get the visible layer name, however, I cannot seem to modify it to work for toggling the div visibility:
var deferred = identifyTask.execute(identifyParams); deferred.addCallback(function(response){      return dojo.map(response, function(result){      var feature=result.feature;      feature.attributes.layerName = result.layerName;         var template = new esri.InfoTemplate("${Name}", "${*}");      feature.setInfoTemplate(template);      return feature;      }); });      map.infoWindow.setFeatures([deferred]); map.infoWindow.show(evt.mapPoint);


Could someone please provide guidance on how I can go about this?  Thanks in advance.


if (layer.visibleLayers =='layerid'){
   dojo.byId("dib").style.display = 'none';
  }
0 Kudos