Attribution Position in jsapi 3.x

619
2
09-12-2019 02:23 AM
ChristianPagel1
New Contributor II

How can I set the Position of Attribution (Copyright Text) to the Bottom of the Map?

Tags (2)
0 Kudos
2 Replies
Egge-Jan_Pollé
MVP Regular Contributor

Hi Christian Pagel,

Can you please tell us a little bit more about what you want to accomplish?

By default, in jsapi 3.x (and also in jsapi 4.x) the attribution is positioned at the bottom of the map, see e.g. this simple sample:

ArcGIS API for JavaScript Sandbox 

HTH,

Egge-Jan

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Here is how to do that through direct dom manipulation.

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
    <title>Simple Map</title>
    <link rel="stylesheet" href="https://js.arcgis.com/3.29/esri/css/esri.css">
    <style>
      html, body, #map {
        height: 100%;
        margin: 0;
        padding: 0;
      }
      #attrDiv {
        position: absolute;
        right: 5px;
        top: 5px;
        z-index: 30;
        text-align: right;
      }
    </style>
    <script src="https://js.arcgis.com/3.29/"></script>
    <script>
      var map;

      require(["esri/map", "dojo/query", "dojo/dom-construct","dojo/domReady!"], function(Map, query, domConstruct) {
        map = new Map("map", {
          basemap: "topo",  //For full list of pre-defined basemaps, navigate to http://arcg.is/1JVo6Wd
          center: [-122.45, 37.75], // longitude, latitude
          zoom: 13
        });
        var attSpan = query(".esriAttribution")[0];
        var attDiv = domConstruct.create('div', {id:'attrDiv'});
        domConstruct.place(attSpan, attDiv);
        domConstruct.place(attDiv, "map_container");
      });
    </script>
  </head>

  <body>
    <div id="map"></div>
  </body>
</html>
0 Kudos