【发布时间】:2012-06-14 10:25:47
【问题描述】:
我正在尝试使用 Twitter Bootstrap 弹出框/工具提示,但我在控制台中收到以下错误:
Uncaught TypeError: Object #<Object> has no method 'popover'
我的函数文件中有以下内容来包含这些文件,这些文件可以在源代码中看到并在单击时指向正确的脚本:
add_action('wp_enqueue_scripts','dcr_enqueue_scripts');
if(!function_exists('dcr_enqueue_scripts')):
function dcr_enqueue_scripts(){
wp_register_script('tooltip',get_template_directory_uri().'/js/bs-tooltip.js','jquery');
wp_register_script('popover',get_template_directory_uri().'/js/bs-popover.js',array('jquery','tooltip'),'1.0');
wp_enqueue_script('tooltip');
wp_enqueue_script('popover');
}
endif;
以下元素期待弹出框:
<th><span>Description:</span><img class="popoverthis" src="<?php bloginfo('template_url')?>/images/info.png" data-content="This is the content" title="Title"></th>
而页面中包含的调用popover函数的jQuery是这样的:
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('.popoverthis').popover({
placement: "bottom"
});
});
对于解决此问题的任何想法将不胜感激。
【问题讨论】:
-
您能否发布您网站的演示并指出问题区域的位置?您的设置应该可以工作。您是否包含工具提示所需的 CSS?
标签: php jquery wordpress twitter-bootstrap tooltip