[英]How to show google map when user hovers over static image in html document
I would like to know to show a google map in a lightbox when a user clicks on an image. 我想知道当用户点击图片时在灯箱中显示Google地图。
For Example:- 例如:-
<img src="map_icon.png" alt="hover over image to show corresponding map" onclick="run_map_function();" />
I would really like to know how to do this. 我真的很想知道该怎么做。 Any help will be much appreciated!
任何帮助都感激不尽! Thankyou.
谢谢。
我不太确定是否可以使用灯箱插件,但可以尝试使用JqueryUi对话框,它易于使用,可以在几秒钟内设置。看一下我的小提琴http://jsfiddle.net/theodore/trnZS/49 /
Does the map need to be interactive? 地图需要互动吗? if not, you should look at using the static maps api:
如果没有,您应该看看使用静态地图api:
https://developers.google.com/maps/documentation/staticmaps/ https://developers.google.com/maps/documentation/staticmaps/
Basically, you can use the static maps api to generate an image of the location you want to view, like here: http://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=14&size=512x512&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Ccolor:red%7Clabel:C%7C40.718217,-73.998284&sensor=false 基本上,您可以使用静态地图api生成要查看的位置的图像,例如: http : //maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York, NY&zoom = 14&size = 512x512&maptype = roadmap&markers =颜色:蓝色%7Clabel:S%7C40.702147,-74.015794&markers =颜色:绿色%7Clabel:G%7C40.711614,-74.012318&markers =颜色:红色%7Ccolor:红色%7Clabel: C%7C40.718217,-73.998284&sensor = false
If you need an interactive map, then I suggest using an iFrame (which would mean creating a separate page for the map). 如果需要交互式地图,则建议使用iFrame(这意味着为地图创建一个单独的页面)。 You should easily be able to show an iframe from your lightbox.
您应该可以轻松地从灯箱中显示iframe。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.