@widelab-nc/widelab 1.1.30 → 1.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/src/index.js +55 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1149,6 +1149,58 @@ window.formatCounter = function() {
|
|
|
1149
1149
|
animateValue(88.0, 110.85, 3500);
|
|
1150
1150
|
}
|
|
1151
1151
|
|
|
1152
|
+
// Filtering logic on Client's page - scroll trigger version
|
|
1153
|
+
window.formatCounterOnScroll = function() {
|
|
1154
|
+
function format_number(x) {
|
|
1155
|
+
let parts = x.toFixed(1).split(".");
|
|
1156
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
1157
|
+
let formattedNumber = parts.join(".");
|
|
1158
|
+
let digits = formattedNumber.split('').map(char => {
|
|
1159
|
+
if (char === '.') {
|
|
1160
|
+
return char;
|
|
1161
|
+
} else {
|
|
1162
|
+
return `<span class="single-number">${char}</span>`;
|
|
1163
|
+
}
|
|
1164
|
+
}).join('');
|
|
1165
|
+
return digits;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
function easeOutQuad(t) {
|
|
1169
|
+
return t * (2 - t);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
function animateValue(start, end, duration) {
|
|
1173
|
+
const counter = document.getElementById('counter');
|
|
1174
|
+
let startTimestamp = null;
|
|
1175
|
+
const step = (timestamp) => {
|
|
1176
|
+
if (!startTimestamp) startTimestamp = timestamp;
|
|
1177
|
+
const progress = Math.min((timestamp - startTimestamp) / duration, 1);
|
|
1178
|
+
const easedProgress = easeOutQuad(progress);
|
|
1179
|
+
const currentValue = start + (end - start) * easedProgress;
|
|
1180
|
+
counter.innerHTML = format_number(currentValue);
|
|
1181
|
+
if (progress < 1) {
|
|
1182
|
+
window.requestAnimationFrame(step);
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1185
|
+
window.requestAnimationFrame(step);
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
// Scroll trigger
|
|
1189
|
+
const counterEl = document.getElementById('counter');
|
|
1190
|
+
if (!counterEl) return;
|
|
1191
|
+
|
|
1192
|
+
const observer = new IntersectionObserver((entries, observer) => {
|
|
1193
|
+
entries.forEach(entry => {
|
|
1194
|
+
if (entry.isIntersecting) {
|
|
1195
|
+
animateValue(88.0, 110.85, 3500);
|
|
1196
|
+
observer.unobserve(entry.target);
|
|
1197
|
+
}
|
|
1198
|
+
});
|
|
1199
|
+
}, { threshold: 0.5 });
|
|
1200
|
+
|
|
1201
|
+
observer.observe(counterEl);
|
|
1202
|
+
};
|
|
1203
|
+
|
|
1152
1204
|
// GSAP Counter Up Animation onc Client's Page
|
|
1153
1205
|
window.counterUpAnimation = function() {
|
|
1154
1206
|
|
|
@@ -1187,7 +1239,7 @@ window.counterUpAnimation = function() {
|
|
|
1187
1239
|
window.requestAnimationFrame(step);
|
|
1188
1240
|
}
|
|
1189
1241
|
|
|
1190
|
-
animateValue(
|
|
1242
|
+
animateValue(88.8, 110.85, 3500);
|
|
1191
1243
|
|
|
1192
1244
|
|
|
1193
1245
|
const counters = document.querySelectorAll('#counter');
|
|
@@ -1566,6 +1618,8 @@ window.closeInfoBar = function() {
|
|
|
1566
1618
|
}
|
|
1567
1619
|
|
|
1568
1620
|
|
|
1621
|
+
|
|
1622
|
+
|
|
1569
1623
|
// !!!!!!!!! Keep this Alpine init at the end !!!!!!!!!
|
|
1570
1624
|
window.Webflow ||= [];
|
|
1571
1625
|
window.Webflow.push(() => {
|