使用javascript验证选项卡

时间:2012-09-21 15:22:09

标签: javascript wordpress google-maps javascript-events

在我的网站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>&nbsp;</p>
<p><iframe src="http://maps.google.pt/maps?f=q&amp;source=s_q&amp;hl=pt-BR&amp;geocode=&amp;q=42.654471,-2.914153&amp;aq=&amp;sll=41.236676,-8.332331&amp;sspn=0.593802,1.234589&amp;ie=UTF8&amp;ll=40.654471,-7.914153&amp;spn=0.018721,0.038581&amp;t=m&amp;z=14&amp;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&amp;source=embed&amp;hl=pt-BR&amp;geocode=&amp;q=40.654471,-7.914153&amp;aq=&amp;sll=41.236676,-8.332331&amp;sspn=0.593802,1.234589&amp;ie=UTF8&amp;ll=40.654471,-7.914153&amp;spn=0.018721,0.038581&amp;t=m&amp;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>&nbsp;</p>
<p>&nbsp;</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>&nbsp;</p>
<p><iframe src="http://maps.google.pt/maps?f=q&amp;source=s_q&amp;hl=pt-BR&amp;geocode=&amp;q=35.541329,-7.730044&amp;aq=&amp;sll=40.654483,-7.914145&amp;sspn=0.00936,0.01929&amp;g=40.654483,-7.914145&amp;ie=UTF8&amp;ll=40.741339,-7.730044&amp;spn=0.018696,0.038581&amp;t=m&amp;z=14&amp;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&amp;source=embed&amp;hl=pt-BR&amp;geocode=&amp;q=40.741339,-7.730044&amp;aq=&amp;sll=40.654483,-7.914145&amp;sspn=0.00936,0.01929&amp;g=40.654483,-7.914145&amp;ie=UTF8&amp;ll=40.741339,-7.730044&amp;spn=0.018696,0.038581&amp;t=m&amp;z=14" target="_blank">Large Map</a></small><br />
</div></div><!-- end div.wp-tab-content --></p>
<p></div><!-- end div.wp-tabs -->

0 个答案:

没有答案