【问题标题】:How can I access the event on underlay element?如何访问底层元素上的事件?
【发布时间】:2013-05-06 01:20:03
【问题描述】:

我有一个 div,其中包含一个带地图的 iframe 和另一个与地图重叠的 div。

HTML

<div class="locationFinder">
    <iframe width="100%" height="100%" frameborder="0" scrolling="no"
            marginheight="0" marginwidth="0"
            src="https://maps.google.com/?ie=UTF8&amp;t=m&amp;ll=37.449105,-122.16048&amp;spn=0.003918,0.009634&amp;z=16&amp;output=embed">
    </iframe>

    <div class="mapover">
        <p class="titleTextM">Want to learn more?</p>
    </div>
</div>

CSS

.locationFinder {
    position: relative;
    width: 100%;
    height: 425px;
    background-repeat: no-repeat;
}
.mapover {
    position: absolute;
    top: 0;
    width: 100%;
    height: 428px;
    background-repeat: no-repeat;
    background: black;
    opacity: .5;
}

第二个 div 在地图上。所以我无法对其执行任何操作。 所以我的要求是,用户仍然可以使用地图。有什么办法可以实现吗?

【问题讨论】:

标签: javascript html css web map


【解决方案1】:

你在你的 mapover css 类中尝试过pointer-events: none; 吗?对于某些版本的 ie,这可能需要额外的 CSS。

【讨论】:

  • +1 不知道这是可能的。我在modified demo 中尝试过。似乎在 Firefox 和 Chrome 中运行良好。但是,在 IE 或 Opera 中是 not supported(如果重要的话)。
  • 我已经看到它在 IE 中与 pnotify 警报库一起工作。应该只是一个过滤器。啊哈。同样的问题:stackoverflow.com/questions/3680429/…
猜你喜欢
  • 2017-05-17
  • 2017-07-07
  • 1970-01-01
  • 2015-10-31
  • 2018-02-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-11
相关资源
最近更新 更多