如何使用 Jquery 或 Jquery 插件生成像 Google 地图中那样的弹出窗口?
当您使用 Google 地图时,单击地图上的标记,然后会弹出一个窗口。您甚至可以输入您的手机号码并接收来自 Google 的短信。如何使用 Jquery 或 Jquery 插件生成弹出窗口?
When you use Google Maps, you click a marker on a map, then a window will pop up. You can even enter your mobile phone number and receives a sms from Google. How to generate that popup window using Jquery or Jquery plugin?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设 Google 地图只是您想要的效果的一个示例,而不是您的项目基础:
这实际上只不过是显示特定的 div,然后隐藏它。
-
-
如果 Google 地图实际上是您的项目基础,我建议您查看 jMaps,一个 jQuery谷歌地图插件。添加标记和 pointHTML(您所说的那些窗口)的示例可以在这里找到:http://github.com/digit...Google.Markers.AddMarker.html
I'm assuming Google Maps is merely an example of the effect you want, and not your project-base:
This is really nothing more than showing a specific div, and later hiding it.
-
-
If Google Maps is actually your project-base, I would suggest checking out jMaps, a jQuery Google Maps Plugin. Examples of adding Markers and pointHTML (those windows you speak of) can be found here: http://github.com/digit...Google.Markers.AddMarker.html
有各种各样的变体,但基本上您要做的是:
在你的弹出窗口中框应包含一个按钮或其他一些控件以允许将其删除。您可以使用 jQuery offset() 函数查找被单击的内容的页面位置,然后可以使用位置信息(左上角)来定位浮动元素。您的浮动元素可能应该使用绝对定位进行定位,并给出一个大于周围内容的“z-index”值。
具体如何做到这一点实际上很大程度上取决于您的网站的外观、其他内容的排列和定位方式以及您如何获取/合成弹出窗口的内容。
There are all sorts of variations, but basically what you'll do is:
Among the things your pop-up box should contain is a button or some other control to allow it to be removed. You can use the jQuery offset() function to find the page position of something that was clicked on, and then the position information (top left corner) can be used to position your floating element. Your floating element should probably be positioned with absolute positioning and given a "z-index" value that's bigger than the surrounding content.
Exactly how you do this really depends a lot on what your site looks like, how the other content is arranged and positioned, and how you get/synthesize the content of the popups.