1.0.0 • Published 7 years ago

grid.js v1.0.0

Weekly downloads
3
License
-
Repository
-
Last release
7 years ago

grid.js

Simple fractional JS grid prototype. Makes adding fractions to markup easy.

Installation

Import it into your project someway, somehow.

Usage

<html data-breakpoints="1024">
  <body>
    <div data-w="1/2 2/3">A</div>
    <div data-w="1/2 1/3">B</div>
  </body>
</html>

It's mobile-first only (for now). That example will default to 1/2 elements on mobile. When the viewport hits 1024px wide, the layout will change so the first element is 2/3 width, the second element 1/3 width.

Details

Does this by adding a stylesheet with JS, then inserts simple/clean rulesets.

The above examples JS-stylesheet would be:

[data-w="1/2 2/3"] { width: calc(50%); }
@media (min-width: 1024px) {
  [data-w="1/2 2/3"] {
    width: calc(66.6667%);
  }
}

[data-w="1/2 1/3"] { width: calc(50%); }
@media (min-width: 1024px) {
  [data-w="1/2 1/3"] {
    width: calc(33.3333%);
  }
}

Wishlist

  • Combine rulesets as much as possible so it looks a bit cleaner. The same rules (say <div data-w="1/2"></div> <div data-w="1/2"></div>) currently get duplicate rules. 😅
  • Gotta go faster! 🏎
1.0.0

7 years ago

0.0.26

10 years ago

0.0.25

10 years ago

0.0.24

10 years ago

0.0.23

10 years ago

0.0.22

10 years ago

0.0.21

10 years ago

0.0.20

10 years ago

0.0.19

10 years ago

0.0.18

10 years ago

0.0.17

10 years ago

0.0.16

10 years ago

0.0.15

10 years ago

0.0.14

10 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago