diff --git a/src/responsive.ts b/src/responsive.ts index 94c3363..55b2a5d 100644 --- a/src/responsive.ts +++ b/src/responsive.ts @@ -11,6 +11,22 @@ export default class Responsive this.minWidth = minWidth; this.margin = margin; } + + getBlockWidth(currentWidth: number) + { + // Loop through all the possible numbers on screen + [1, 2, 3, 4, 5, 6].forEach(i => + { + // Calculate margin width + let margins = vhToPx(this.margin) * (i + 1); + + // Calculate block width + let blockWidth = (currentWidth - margins) / i; + + // Return block width + if (blockWidth > this.minWidth && blockWidth < this.maxWidth) return blockWidth; + }); + } } /**