diff --git a/.changeset/famous-items-tap.md b/.changeset/famous-items-tap.md new file mode 100644 index 000000000..3854c566b --- /dev/null +++ b/.changeset/famous-items-tap.md @@ -0,0 +1,5 @@ +--- +"@tabler/core": patch +--- + +Enable `scrollSpy` in `countup` module diff --git a/src/js/src/countup.js b/src/js/src/countup.js index edc132bda..7ff7fb5fb 100644 --- a/src/js/src/countup.js +++ b/src/js/src/countup.js @@ -4,7 +4,9 @@ if (elements.length) { elements.forEach(function (element) { let options = {}; try { - options = element.getAttribute('data-countup') ? JSON.parse(element.getAttribute('data-countup')) : {}; + 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); @@ -14,4 +16,4 @@ if (elements.length) { countUp.start(); } }); -} \ No newline at end of file +}