[英]how to insert google map in popup or lightbox?
I want to ask! 我想问问! I'm designing an application, but there is a problem in inserting a google map in a popup or lightbox which display the map can not meet the "div id="wrap_peta"" like in the picture .
我设计的应用程序,但在将其显示在地图不能满足“DIV ID =” wrap_peta“”就像在一个弹出窗口或灯箱一个谷歌地图有问题的画面 。 The problem is not caused by the failure loading map
问题不是由加载映射失败引起的
I asked for help from all of what's wrong in my script thanks fo everyone 感谢所有人,我在脚本中找到了所有错误的帮助
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/lightbox.css"/>
<link rel="stylesheet" type="text/css" href="css/index.css"/>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<script type="text/javascript">
function load_peta()
{
var semarang = new google.maps.LatLng(-7.201470266411334, 110.08918792956547);
var petaoption = {
zoom: 9,
center: semarang,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
peta = new google.maps.Map(document.getElementById("peta"),petaoption);
google.maps.event.addListener(peta,'click',function(event){
kasihtanda(event.latLng);
});
load_list_terminal('awal');
}
google.maps.event.addDomListener(window, 'load', load_peta);
</script>
<title>Untitled Document</title>
</head>
<body>
<!--Bagian Bar Navigasi Atas termasuk search -->
<div id="bar_atas">
<div style="margin:auto; margin-top:5px; padding:5px 5px 5px 5px; height:50px; width:90%;">
<h1>GIS Hubkominfo</h1>
</div>
</div>
<div>
<p><a onclick="show_lightbox()" href="javascript:void()">input terminal</a></p>
</div>
<div id="background" onclick="hide_lightbox()" class="bgdasar"></div>
<div id="popup" class="wraplightbox" style="margin:auto">
<p onclick="hide_lightbox()" style="cursor:pointer">tutup</p>
<div id="peta" style="height:300px; margin-bottom:10px; border:solid #999 2px;"></div>
</div>
</body>
</html>
Look at this question . 看看这个问题 。
It has the right code for the popup of google maps. 它具有正确的谷歌地图弹出窗口代码。
I took a look at the first link 3dgoo told us. 我看了3dgoo告诉我们的第一个链接。 It's working great as people are using it like on this website: Pallas restaurant.
当人们在这个网站上使用它时,它的工作效果很好: Pallas restaurant。 The link is at the bottom-left for the popup of google maps.
链接位于谷歌地图弹出窗口的左下角。
---------------EDIT--------------- - - - - - - - -编辑 - - - - - - - -
I did not tell the site where the code belongs, but here you go! 我没有告诉网站代码所在的位置,但是你走了!
Create the division for the map inside the initilaser of colorbox. 在colorbox的初始化程序内创建地图的分区。
var link = document.getElementById("seeMap");
link.colorbox({
html: '<div id="MapPane" class="mapClass"></div>',
scrolling: false,
width: "1000px",
onComplete: function(){
loadMap();
}
})
function loadMap()
{
var map = new google.maps.Map(document.getElementById("MapPane"),mapoptions);
}
This will work. 这会奏效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.