我有一张我办公室的地图图像,我想在我的网站上使用它,但我希望用户可以选择单击该图像以在灯箱中调出谷歌地图位置......
我浏览了这里的问题以找到答案,但似乎找不到!
本质上,我有:
<a href="http://maps.google.co.uk/maps?q=????????&hl=en&sll=???????,-???????1&sspn=??.??????,??.5??????&z=??" target="_blank"><img src="css/images/map.gif" width="655" height="320" /></a>
Map.gif 是一个动画 gif。我目前在页面上唯一的 JavaScript 是
<script type='text/javascript' src='jquery-1.4.3.min.js'></script>
<script type="text/javascript">
$(function(){ // $(document).ready shorthand
$('#map').hide().fadeIn(2000);
});
</script>
将图像淡入屏幕。任何想法!
谢谢
京东
I have an image of a map to my office that I would like to use on my website, but I want there to be the option for the user to click on the image to pull up the google maps location in a lightbox....
I have looked through the questions here to find the answer, but cannot seem to find it!
Essentially, I have:
<a href="http://maps.google.co.uk/maps?q=????????&hl=en&sll=???????,-???????1&sspn=??.??????,??.5??????&z=??" target="_blank"><img src="css/images/map.gif" width="655" height="320" /></a>
Map.gif is an animated gif. The only javascript I currently have on the page is
<script type='text/javascript' src='jquery-1.4.3.min.js'></script>
<script type="text/javascript">
$(function(){ // $(document).ready shorthand
$('#map').hide().fadeIn(2000);
});
</script>
which fades the image into the screen. Any ideas!!
Thanks
JD
发布评论
评论(1)
这是我处理此类事件的方式
和
到您的 html 文件中。
2.灯箱的CSS:
最后你需要一个javascript:
函数 showLightBox() {
document.getElementById('light').style.display='block';
document.getElementById('fade').style.display='block';
}
想要隐藏灯箱时,您可以调用一个自定义函数,该函数设置
document.getElementById('light').style.display='none';
和document.getElementById('fade').style.display='none';
要在灯箱中获取 Google 地图,请在 javascript 中使用以下代码行:
将内容推送到灯箱。通常,您使用 Ajax 将内容获取到灯箱。
如果您不知道如何嵌入 google 地图,可以在此处找到文档:
http://code.google.com/apis/maps/documentation/javascript/
This is my way of handeling such an event
<div id='lightbox' class='white_content'></div>
and<div id='fade' class='class='black_overlay'></div>
into your html file.2.Your CSS for the lightbox:
And finaly you need a javascript:
function showLightBox() {
document.getElementById('light').style.display='block';
document.getElementById('fade').style.display='block';
}
When you want to hide the lightbox, you make a custom function to call, that sets
document.getElementById('light').style.display='none';
anddocument.getElementById('fade').style.display='none';
To get the google map inside your lightbox, use this line of code inside your javascript:
to push content to your lightbox. Normaly you use Ajax to get content to a lightbox
If you don't know how to embed google maps, you can finde the documentation here:
http://code.google.com/apis/maps/documentation/javascript/