Pārlūkot izejas kodu

Enable scrollSpy in countup module (#2113)

Co-authored-by: Paweł Kuna <[email protected]>
carlosmintfan 7 mēneši atpakaļ
vecāks
revīzija
d3ae77cf8b
2 mainītis faili ar 9 papildinājumiem un 2 dzēšanām
  1. 5 0
      .changeset/famous-items-tap.md
  2. 4 2
      src/js/src/countup.js

+ 5 - 0
.changeset/famous-items-tap.md

@@ -0,0 +1,5 @@
+---
+"@tabler/core": patch
+---
+
+Enable `scrollSpy` in `countup` module

+ 4 - 2
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();
 		}
 	});
-}
+}