我遇到了一个问题,我似乎无法解决加载包含谷歌地图的页面内容。以下是包含父标题和google api信息的index.php页面。谷歌地图和jquery.Load问题
<html>
<head>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.7.2.min.js"></script>
<!-- Google Maps -->
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(-34.397, 150.644),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("location-wedding"),
mapOptions);
}
</script>
<!-- Switch Layout -->
<script type="text/javascript">
$(document).ready(function() {
$('.Theme_Page').load("test.php");
});
</script>
</head>
<body onload="initialize()">
<!-- Page Change -->
<div class="theme_holder">
</div>
<div class="Theme_Page">
<!-- Content To Go Here -->
</div>
</body>
在被加载的页面是以下内容:
<div id="location-wedding" style="width:700px; height:250px"></div>
问题是如果上述DIV是在index.php内,那么地图存在,只要它将它放在要加载的页面中,它根本不显示。为什么我要它在.load()页面的原因是因为我打算使用Jquery来更改此页面上的内容(使用onclick事件)
任何帮助或指导都是最受赞赏。
干杯李。
'load(“test.php”,initialize)'试试这个吗? – Val
嗨瓦尔,这工作,唯一的争议是,当点击更改内容按钮时,地图(也出现在其他HTML页面正在加载)消失。代码是: $('。theme_holder:button')。click(function(){ var page = $(this).attr('href'); $(“#theme-loading”)。html ('Loading'); setTimeout(function(){$('。Theme_Page')。load(''+ page +'。php',null,function(){(“#theme-loading”)。 html(''); });},150); return false; }); \t }); 再次感谢。 – HireLee