positionPaymentDot.ts
unknown
typescript
2 years ago
479 B
1
Indexable
Never
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}%`; }