mirror of
https://github.com/tabler/tabler.git
synced 2025-12-21 17:34:25 +04:00
Monorepo structure, remove Gulp, new build process (#2116)
This commit is contained in:
19
core/js/src/countup.js
Normal file
19
core/js/src/countup.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const elements = document.querySelectorAll('[data-countup]');
|
||||
|
||||
if (elements.length) {
|
||||
elements.forEach(function (element) {
|
||||
let options = {};
|
||||
try {
|
||||
const dataOptions = element.getAttribute('data-countup') ? JSON.parse(element.getAttribute('data-countup')) : {};
|
||||
options = Object.assign({'enableScrollSpy': true}, dataOptions);
|
||||
|
||||
} catch (error) {}
|
||||
|
||||
const value = parseInt(element.innerHTML, 10);
|
||||
|
||||
const countUp = new window.countUp.CountUp(element, value, options);
|
||||
if (!countUp.error) {
|
||||
countUp.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user