Created
February 9, 2019 23:26
-
-
Save xdmorgan/eba5294e3902dd776083f32c1312a198 to your computer and use it in GitHub Desktop.
Calculate percentage based grid columns + gaps to set a fixed size for an element spanning n columns, for reasons.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const calculateGridItemWidth = (span, cols = 24, gap = 16) => | |
((window.innerWidth - (cols + 1) * gap) / cols) * span + gap * (span - 1); | |
this.calculateGridItemWidth(18) |
Author
xdmorgan
commented
Feb 9, 2019
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment