-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use it simple or with jquery ? #2
Comments
@bfintal, I was kind of trying to say same thing in #1. In other words can we have a demo which doesn't require any server-side stuff because currently many are using https://github.com/bfintal/Counter-Up with jquery. If needed I can help you with something. |
i am getting confused how to initialized it in script ? can anyone help me |
Allow me.
|
For https://github.com/bfintal/Counter-Up2/releases/tag/v1.0.1, extract the jQuery(function ($) { // using failsafe $ alias here, see https://api.jquery.com/jQuery/#jQuery3
"use strict";
var counterUp = window.counterUp["default"]; // import counterUp from "counterup2"
var $counters = $(".counter"); // see https://api.jquery.com/jQuery/#jQuery1
/* Start counting, do this on DOM ready or with Waypoints. */
$counters.each(function (ignore, counter) { // see https://api.jquery.com/each/
counterUp(counter, {
duration: 1000,
delay: 16
});
});
}); |
Not working for me. |
@jkdoyle Did you see any error in the console? Does
|
Please make jquery compatibility to easy uses. |
Andrew-Cottrell's suggestion works fine for me. Here is an example with Waypoint: |
Andrew-Cottrell's suggestion works fine for me also. |
Hi Andrew. Does your library work with jquery 3+? |
@yargohor
It is not my library; I merely commented above how I used
|
can I include Waypoints.js? |
@markcnunes has kindly provided an example with Waypoint. |
How to use it simple or with jquery ?
counterUp( document.querySelector('.counter_number1'), { duration: 1000, delay: 16 } );
I have this error: Uncaught TypeError: counterUp is not a function
I use it with jquery and bootstrap 4 libs.
The text was updated successfully, but these errors were encountered: