Browse code

fixed sidebar columnization

Brandon Mathis authored on 13/07/2011 at 15:57:44
Showing 2 changed files
... ...
@@ -19,7 +19,7 @@ body {
19 19
   max-width: $max-width;
20 20
   position: relative;
21 21
   margin: 0 auto;
22
-  > header, > nav, > footer, #content > article, #content > div > article {
22
+  > header, > nav, > footer, #content > article, #content > div > article, #content > div > nav {
23 23
     @extend .group;
24 24
     padding-left: $pad-min;
25 25
     padding-right: $pad-min;
... ...
@@ -60,10 +60,10 @@ body {
60 60
   #content aside {
61 61
     @extend .group;
62 62
     section {
63
-    &.odd, &.even { float: left; width: 48%; }
64
-    &.odd { margin-left: 0; }
65
-    &.even { margin-left: 4%; }
66
-   }
63
+      &.odd, &.even { float: left; width: 48%; }
64
+      &.odd { margin-left: 0; }
65
+      &.even { margin-left: 4%; }
66
+    }
67 67
   }
68 68
 }
69 69
 @media only screen and (min-width: 768px) {
... ...
@@ -89,7 +89,10 @@ body {
89 89
       background: none;
90 90
       float: left;
91 91
       margin: 0 -100% 0 0;
92
-      section, section.even { width: auto; margin: 0; }
92
+      section {
93
+        width: auto; margin-left: 0;
94
+        &.odd, &.even { float: none; width: auto; margin-left: 0; }
95
+      }
93 96
     }
94 97
     .collapse-sidebar & {
95 98
       margin-right: 10px;
... ...
@@ -21,14 +21,16 @@ function addSidebarToggler() {
21 21
     }
22 22
   });
23 23
   sections = $('aside[role=sidebar] > section')
24
+  if(sections.length > 1){
25
+    sections.each(function(section, index){
26
+      if ((sections.length >= 3) && index % 3 == 0) {
27
+        $(section).addClass("first");
28
+      }
29
+      count = ((index +1) % 2) ? "odd" : "even";
30
+      $(section).addClass(count);
31
+    });
32
+  }
24 33
   if(sections.length >= 3){ $('aside[role=sidebar]').addClass('thirds') }
25
-  sections.each(function(section, index){
26
-    if ((sections.length >= 3) && index % 3 == 0) {
27
-      $(section).addClass("first");
28
-    }
29
-    count = ((index +1) % 2) ? "odd" : "even";
30
-    $(section).addClass(count);
31
-  });
32 34
 }
33 35
 function testFeatures() {
34 36
   var features = ['maskImage'];