我读过其他类似的帖子,但没有一个问题/回答能够简单明了地解释我需要做什么。我正在使用可能解释了其他问题中发布的某些代码不同的jQuery版本1.7。
谷歌地图在slideToggle'd div中加载,中心点偏移到西北方向,并且在打开div时相对于显示的地图部分不可见。我试图显示一个非常简单的地图,没有任何花哨的东西。
jQuery(".toggle").click(function () {
// check the visibility of the next element in the DOM
jQuery(this).next().slideToggle(); // slide it down
});
我的jQuery知识有限,但我了解需要在div切换后强制iframe加载。我只是不知道如何实现!以下是HTML / PHP代码。
<span class="toggle">
View Map // with some CSS
</span>
<div id="maps" class="ui-helper-hidden">
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=<?php echo $latitude;?>,<?php echo $longitude;?>&aq=&t=m&z=13&output=embed&key=123456789"></iframe>
</div>