Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenLayers.Map change position of Attribution in JavaScript

I have included an OpenLayers.Map in my site per JavaScript:

var map = new OpenLayers.Map();
var mapnik = new OpenLayers.Layer.OSM();
map.addLayer(mapnik);

All works fine. Expect the position of the attribution (OpenStreetMap contributors). Are there any option move the attribution in the lower right corner?

Here is what i got currently: OpenStreetMap example

like image 637
michael Avatar asked Jan 07 '14 20:01

michael


2 Answers

You can override the default OL style for this component:

.olControlAttribution {
  left: 5px;
}

You can try this out by going to http://dev.openlayers.org/examples/attribution.html and executing the following JS code in your browser's console:

document.getElementsByClassName('olControlAttribution')[0].style.left='5px'
like image 165
kryger Avatar answered Sep 20 '22 10:09

kryger


Not sure what version is being used in this question but I was using V3 and had to use the following class to change the attribution instead:

.ol-attribution
like image 25
Whirlwind991 Avatar answered Sep 19 '22 10:09

Whirlwind991