Skip to content

Commit

Permalink
increase fixed / absolute flexibility
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Apr 12, 2011
1 parent d9bae8d commit 88b283b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
17 changes: 5 additions & 12 deletions lib/nib/positions.styl
@@ -1,16 +1,9 @@

-pos(type, pos)
position type
if length(pos) == 2
{pos[0]} 0
{pos[1]} 0
else if length(pos) == 4
a = pos[0..1]
b = pos[2..3]
{a[0]} a[1]
{b[0]} b[1]
else
error('invalid arguments. ' + type + ': <pos> [n] <pos> [n];')
-pos(type, args)
i = 0
position: type
{args[i]}: args[i + 1] is a 'unit' ? args[i += 1] : 0
{args[i += 1]}: args[i + 1] is a 'unit' ? args[i += 1] : 0

fixed()
-pos(fixed, arguments)
Expand Down
10 changes: 10 additions & 0 deletions test/cases/fixed.css
Expand Up @@ -7,4 +7,14 @@
position: fixed;
top: 5px;
left: 10px;
}
#login {
position: fixed;
bottom: 0;
left: 10px;
}
#login {
position: fixed;
bottom: 10px;
right: 0;
}
10 changes: 8 additions & 2 deletions test/cases/fixed.styl
Expand Up @@ -2,7 +2,13 @@
@import 'nib/positions'

#login
fixed bottom right
fixed: bottom right

#login
fixed top 5px left 10px
fixed: top 5px left 10px

#login
fixed: bottom left 10px

#login
fixed: bottom 10px right

0 comments on commit 88b283b

Please sign in to comment.