Unsure why $(...).counterUp is not a function
.
Waypoints
is enqueued after Counter-up
.View source ordering:
<script type='text/javascript' src='http://testsite.com/wp-includes/js/jquery/jquery.js?ver=1.12.4-wp'></script>
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/Counter-Up/1.0.0/jquery.counterup.min.js?ver=5.2.3'></script>
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.1/jquery.waypoints.js?ver=5.2.3'></script>
How I'm enqueuing Waypoints
and CounterUp
:
wp_enqueue_script( 'counterup', 'https://cdnjs.cloudflare.com/ajax/libs/Counter-Up/1.0.0/jquery.counterup.min.js', array(), false, false);
wp_enqueue_script( 'waypoints', 'https://cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.1/jquery.waypoints.js', array(), false, false);
JS being used:
jQuery(document).ready(function($) {
$('.counter').counterUp({
delay: 10,
time: 1000
});
});
What am I missing here?
Edit:
Screenshots of where files are loaded:
Have also tried pulling counterup
via node_modules
:
wp_enqueue_script( 'counterup', plugin_dir_url( __FILE__ ) . 'node_modules/counterup/jquery.counterup.min.js' );
... Still get the same error message.
Download jquery.counterup.min.js
and include in your active theme folder/js.
Add below the script in functions.php file.
function counterup_scripts()
{
wp_enqueue_script('counterup', get_stylesheet_directory_uri() . '/js/jquery.counterup.min.js', array(), false, false);
}
add_action('wp_enqueue_scripts', 'counterup_scripts');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With