OpenLayers-HTML DIV叠加层 [英] OpenLayers - HTML DIV overlay

查看:864
本文介绍了OpenLayers-HTML DIV叠加层的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用OpenLayers在标准HTML页面上显示地图,我想创建一个位于地图顶部的div.但是,div似乎总是被地图图块遮盖.

I'm using OpenLayers to display a map on a standard HTML page, and I want to create a div that sits on top of the map. However, the div always seems to be obscured by the map tiles.

我相信有一种向地图本身添加元素的方法,但是在这种情况下,这不是一个可行的选择,因为div可能会部分浮动在地图上,部分浮动在其他页面元素上.

I believe there is a way to add elements to the map itself, but in this case that isn't a viable option since the div will potentially float partially over the map, and partially over other page elements.

<div id="maphost" style="width: 100%; height: 100%" />
<div id="overlay" />

那是基本的HTML.我需要在两个DIV中添加哪些CSS值才能实现此目的?

That is the basic HTML. What CSS values do I need to add to either DIV to make this possible?

推荐答案

添加z-index

<div id="maphost" style="width:100%; height:100%; z-index: 0"></div>
<div id="overlay" style="z-index:9999"></div>

这篇关于OpenLayers-HTML DIV叠加层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆