Hello guys i am a new one so forgive me about possible mistakes! Thank you for your time..I would like to ask what can i do to bring in front of everything a button in my html page? I tried to bring it with "z-index" in styling, but it doesn't work. :( I set the button with a class named "btn". Please it's an emergency because it's for my diploma thesis..thank you! Here is the html file:
function init() {
map = new OpenLayers.Map('basicMap');
var mapnik = new OpenLayers.Layer.OSM();
map.addLayer(mapnik);
navigator.geolocation.getCurrentPosition(function (position) {
document.getElementById('anzeige').innerHTML = 'Latitude: ' +
position.coords.latitude +
' Longitude: ' +
position.coords.longitude + '<p>';
var lonLat = new OpenLayers.LonLat(position.coords.longitude,
position.coords.latitude)
.transform(
new OpenLayers.Projection('EPSG:4326'), //transform from WGS 1984
map.getProjectionObject() //to Spherical Mercator Projection
);
markers.addMarker(new OpenLayers.Marker(lonLat));
map.setCenter(lonLat, 16 // Zoom level
);
});
//map = new OpenLayers.Map("basicMap");
//var mapnik = new OpenLayers.Layer.OSM();
//map.addLayer(mapnik);
map.setCenter(new
OpenLayers.LonLat(3, 3) // Center of the map
.transform(
new OpenLayers.Projection('EPSG:4326'), // transform from WGS 1984
new OpenLayers.Projection('EPSG:900913') // to Spherical Mercator Projection
), 15 // Zoom level
);
var markers = new OpenLayers.Layer.Markers('Markers');
map.addLayer(markers);
}
init();
.btn{
background-color: #000080;
border: none;
color: white;
padding: 3px 20px;
text-align: center;
white-space: nowrap;
font-size: 20px;
left:10px;
top:40px;
cursor: pointer;
position: absolute;
z-index: 110;
}
html, body, #basicMap {
padding: 0px;
margin: 0px;
height: 100%;
}
.p1 {
border: none;
color: white;
padding: 3px 32px;
font-family:courier;
text-decoration: none;
display: inline-block;
font-size: 30px;
margin: 5px 1025px;
position: absolute;
z-index: 100;
font-weight: bold;
white-space: nowrap;
}
.p2 {
border: none;
color: white;
line-height: 80%;
margin: 10px;
}
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<a class="btn" onclick="myFunction(this)" >Select Point</a>
<p class="p1">Sky Detect App</p>
<p class="p2">Your position estimated by browser geolocation API:</p>
<div id="anzeige" class="p2">(will be displayed here)</div>
<div id="basicMap"></div>
i see it like that and itsnot right.. error button's position