positionPaymentDot.ts
unknown
typescript
4 years ago
479 B
13
Indexable
function positionPaymentDot(element: HTMLDivElement) {
const allChildren = Array.from(
(element.parentElement as HTMLDivElement).children
);
let left = 0;
for (let i = 0, x = allChildren.length; i < x; i++) {
const child = allChildren[i] as HTMLDivElement;
if (child.className.includes('progress-bar')) {
left += Number(child.style.width.slice(0, -1));
}
if (child === element) {
break;
}
}
element.style.left = `${left}%`;
}
Editor is loading...