0
我正在构建一个WordPress主题,这将很快需要jQuery UI(只是核心和效果,不包括CSS)(http://hildasjcr.org.uk)。我使用我自己的jQuery和jQuery UI版本,因为我需要使用jQuery Effects,而且我喜欢“$”表示法。我已经包括在functions.php的脚本是这样的:WordPress的 - jQuery UI无法加载
function my_scripts_method() {
wp_deregister_script('jquery');
wp_register_script('jquery', get_template_directory_uri() . "/js/jquery-1.7.2.min.js");
wp_enqueue_script('jquery');
wp_deregister_script('jqueryui');
wp_register_script('jqueryui', get_template_directory_uri() . "/js/jquery-ui-1.8.21.custom.min.js");
wp_enqueue_script('jqueryui');
wp_register_script('footer', get_template_directory_uri() . "/js/footer.js");
wp_enqueue_script('footer');
}
add_action('wp_enqueue_scripts', 'my_scripts_method');
这给下面的HTML代码(剥离到相关的位):
<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
<meta charset="UTF-8" />
<title>Current Students</title>
<link rel="stylesheet" type="text/css" media="all" href="http://hildasjcr.org.uk/wp-content/themes/hildas/style.css" />
<script type='text/javascript' src='http://hildasjcr.org.uk/wp-content/themes/hildas/js/jquery-1.7.2.min.js?ver=3.3.2'></script>
<script type='text/javascript' src='http://hildasjcr.org.uk/wp-content/themes/hildas/js/jquery-ui-1.8.21.custom.min.js?ver=3.3.2'></script>
<script type='text/javascript' src='http://hildasjcr.org.uk/wp-content/themes/hildas/js/footer.js?ver=3.3.2'></script>
</head>
不幸的是,jQuery UI的出现加载,但不可用 - jQuery运行良好,但jQuery UI函数都未定义。
我甚至可以在Chrome的开发人员工具面板中看到列出的jQuery UI,并阅读其中的代码。
那么,出了什么问题,我该如何解决?
你正在加载jQuery的用户界面?你在内容加载后调用'$(selector).tabs()'方法吗? – Johan
只是核心和效果 - 没有包含CSS。 – TDN169
这可能有助于http://stackoverflow.com/questions/6125928/jquery-ui-dialog-stopped-working-gives-error-cannot-call-method-mouseover-o – Johan