在我的网站wordpress我有一个标签插件(WP-UI标签,手风琴,幻灯片),因为在两个标签我有谷歌地图嵌入代码,我需要使用javascript函数(不是jquery,因为我的插件赢了' t允许它强制调整第二张地图的大小,使地图的中心不会到达左上角。
那么,是否有javascritp来制作if以验证我是否在特定标签中调用调整大小的地图?
<script type="text/javascript">
google.maps.event.trigger(map, "resize");
});
</script>
我需要一个if在触发器之前,但我不确定该放在那里。
以下是标签代码:
[wptabs type="accordion" mode="horizontal"]
[wptabtitle] Map 1[/wptabtitle] [wptabcontent]
Here is the google maps code embed.
[/wptabcontent]
[wptabtitle] Map 2[/wptabtitle] [wptabcontent]
Here is the google maps 2 code embed.
[cf]js[/cf] //this is to call the js function
[/wptabcontent]
[/wptabs]
更新代码:
Firefox告诉我这个:
<div id="wp-accordion-1" class="wp-accordion wpui-light wpui-styles"></p>
<p><h3 class="wp-tab-title"> Place A</h3> <div class="wp-tab-content"><div class="wp-tab-content-wrapper"></p>
<p>Coordenadas GPS:<br />
Latitude: Norte<br />
Longitude: Oeste</p>
<p> </p>
<p><iframe src="http://maps.google.pt/maps?f=q&source=s_q&hl=pt-BR&geocode=&q=42.654471,-2.914153&aq=&sll=41.236676,-8.332331&sspn=0.593802,1.234589&ie=UTF8&ll=40.654471,-7.914153&spn=0.018721,0.038581&t=m&z=14&output=embed" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="100%" height="auto"></iframe><br />
<small><a style="color: #0000ff; text-align: left;" href="http://maps.google.pt/maps?f=q&source=embed&hl=pt-BR&geocode=&q=40.654471,-7.914153&aq=&sll=41.236676,-8.332331&sspn=0.593802,1.234589&ie=UTF8&ll=40.654471,-7.914153&spn=0.018721,0.038581&t=m&z=14" target="_blank">Large Map</a></small></p>
<p></div></div><!-- end div.wp-tab-content --></p>
<p><h3 class="wp-tab-title"> Place B</h3> <div class="wp-tab-content"><div class="wp-tab-content-wrapper"></p>
<p> </p>
<p> </p>
<p><script type="text/javascript">
document.write("yoooo!");
google.maps.event.trigger(map, "resize");
document.write("yoooo!");
});
</script></p>
<p>Coordenadas GPS:<br />
Latitude: Norte<br />
Longitude: Oeste</p>
<p> </p>
<p><iframe src="http://maps.google.pt/maps?f=q&source=s_q&hl=pt-BR&geocode=&q=35.541329,-7.730044&aq=&sll=40.654483,-7.914145&sspn=0.00936,0.01929&g=40.654483,-7.914145&ie=UTF8&ll=40.741339,-7.730044&spn=0.018696,0.038581&t=m&z=14&output=embed" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="100%" height="auto"></iframe><br />
<small><a style="color: #0000ff; text-align: left;" href="http://maps.google.pt/maps?f=q&source=embed&hl=pt-BR&geocode=&q=40.741339,-7.730044&aq=&sll=40.654483,-7.914145&sspn=0.00936,0.01929&g=40.654483,-7.914145&ie=UTF8&ll=40.741339,-7.730044&spn=0.018696,0.038581&t=m&z=14" target="_blank">Large Map</a></small><br />
</div></div><!-- end div.wp-tab-content --></p>
<p></div><!-- end div.wp-tabs -->