[英]How to insert a googlemap in a div with mask
i need to put a google map into a div.我需要将谷歌 map 放入 div。 No problem here...the problem is that i need to mask this div.
这里没问题...问题是我需要屏蔽这个div。 I need to have a circular google map that i can navigate!
我需要一个可以导航的圆形谷歌 map!
I try Help pls?我试试请帮忙?
With the Maps API, create a Polygon that covers everything except the circles.使用地图 API,创建一个覆盖除圆圈之外的所有内容的多边形。
To create a circle that doesn't show line segments at every zoom level is challenging, but an approximation with a reasonable circular look should be possible.创建一个在每个缩放级别都不显示线段的圆是具有挑战性的,但应该可以实现具有合理圆形外观的近似值。
As an alternative you could extend the OverlayView class to create a custom overlay type that show a circle with smoother edges.作为替代方案,您可以扩展 OverlayView class 以创建自定义覆盖类型,以显示具有更平滑边缘的圆。 But this would be more work.
但这将是更多的工作。
One solution is to use jquery to get the absolute (x,y) coordinates of each map, and place a div with a png background over it, by positioning the div absolutely.一种解决方案是使用 jquery 获取每个 map 的绝对 (x,y) 坐标,并在其上放置一个带有 png 背景的 div,方法是绝对定位 div。
I'm fairly sure this isn't possible I'm afraid - if you lay anything over the map (even if it is transparent) it will prevent you interacting with the map - as you will be clicking on that div, rather than on the map.我很确定这是不可能的,我担心 - 如果你在 map 上放置任何东西(即使它是透明的),它将阻止你与 map 交互 - 因为你将点击那个 div,而不是点击map。 Also IE seems to have some problems with masking google maps.
此外,IE 似乎在屏蔽谷歌地图方面存在一些问题。
You could have an overlay that dissappears when you hover over it, using jquery or the:hover clss to move it to a negative z-index, but I really don't don't think you can do what you need to do.当您使用 jquery 或:hover 做 cls 时,您可能有一个覆盖消失
(ps - I tried to comment on the answer above - but for some reason I couldn't - sorry for the new answer) (ps - 我试图对上面的答案发表评论 - 但由于某种原因我不能 - 对新答案感到抱歉)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.