我的代码有问题。我想在我的Web项目中导入这个statistic circles库。我收到了这个错误:
TypeError:$(...)。circliful不是函数circle.js:2:2
我已正确导入所有文件:
<script type="text/javascript" src="/wp-content/themes/storefront/jquery.circliful.min.js"></script>
<script type="text/javascript" src="/wp-content/themes/storefront/circle.js"></script>
其次我做了我的:
<div id="test-circle3"></div>
这是circle.js:
jQuery(document).ready(function() {
$("#test-circle3").circliful({
animation: 1,
animationStep: 6,
foregroundBorderWidth: 5,
backgroundBorderWidth: 1,
percent: 88,
iconColor: '#3498DB',
icon: 'f004',
iconSize: '40',
iconPosition: 'middle'
});
});
主管部分:
<head>
<script src="/wp-content/themes/storefront/jquery-3.1.1.min.js"></script>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<link rel="profile" href="https://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_head(); ?>
<script type="text/javascript" src="/wp-content/themes/storefront/scrolling_nav.js"></script>
<script type="text/javascript" src="/wp-content/themes/storefront/styleswitcher.js"></script>
<script type="text/javascript" src="/wp-content/themes/storefront/js.cookie.js"></script>
</head>
答案 0 :(得分:0)
更改wordpress网站中的所有js和css包含路径。
旧网址
<script src="/wp-content/themes/storefront/jquery-3.1.1.min.js"></script>
新网址
<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/jquery-3.1.1.min.js"></script>