Wordpress模态窗口显示谷歌地图

时间:2011-08-04 13:17:23

标签: jquery wordpress google-maps

我按照此处给出的步骤http://wordpressthemescollection.com/simple-modal-google-map-easy-modal-map-boxes-with-jquery-752.html在Wordpress网站的灯箱中显示Google地图。

但代码不起作用。检查Firebug会出现错误" jQuery.modal()不是函数"

我已经确保加载了jQuery和Simple Modal脚本,并且在我要显示地图的页面中我包含了jQuery代码

<a href="http://maps.google.com.." class="map">Show map</a>

....//some more code

jQuery(document).ready(function () {
    jQuery('.map').click(function (e) {
        jQuery.modal('<iframe src="'+this.href+'&output=embed"></iframe><p class="larger"><a target="_blank" href="'+this.href+'">View larger</a></p>');
        return false;
    });
});

我有一种潜在的怀疑,jQuery.modal(....需要更改为jQuery('#someid').modal(),但不知道该怎么做。

请有人了解这里出了什么问题。

非常感谢

编辑:正如我所提到的,我已经在主题header.php中加载了所需的脚本

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>
<script src="/wp-content/themes/thename/js/jquery.simplemodal.1.4.1.min.js" type="text/javascript"></script>

1 个答案:

答案 0 :(得分:1)

似乎没有正确安装jQuery Simple Modal插件。您是否已在文档中包含其js文件?