[+] Create function to determine block width

This commit is contained in:
Hykilpikonna
2019-12-23 11:10:47 -05:00
parent f6a2e81782
commit 0051a8a573
+16
View File
@@ -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;
});
}
}
/**