JSFiddle - React, Tailwind, and code Playground
by Kenny806
HTML
<script src="http://openlayers.org/en/v3.0.0/build/ol.js"></script>
<link rel="stylesheet" href="http://openlayers.org/en/v3.0.0/css/ol.css">
<div style="width:80%; height:80%; position:fixed; border: 1px solid;" id="map"></div>
JavaScript
var attribution = new ol.control.Attribution({
collapsible: true
});
attribution.setCollapsed(true);
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
controls: ol.control.defaults({ attribution: false }).extend([attribution]),
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
})
});
$(".ol-attribution").click(function() {
attribution.setCollapsed(true);
alert("It's showing the attribution anyway");
});