Created
June 22, 2014 01:57
-
-
Save soderalohastrom/3c51f1a13c14069471de to your computer and use it in GitHub Desktop.
Mixin to change gallery container cell widths
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
// Generate responsive rules | |
$max-resolution: 1920px; | |
$cell-width: 250px; | |
// actual cell width should = $cell-width ( 1 - ( 1 / ceil( [the-browser-resolution] / $cell-width ) ) | |
@for $i from 0 to ceil($max-resolution/$cell-width) { | |
$min: $i * $cell-width; | |
$max: ($i + 1) * $cell-width; | |
@include respond-between($min,$max) { | |
$width: 100% / ($i + 1); | |
.container .cell { | |
width: $width; | |
&:nth-child(#{$i + 1}n + 1){ | |
clear: both; | |
} | |
} | |
} | |
} | |
// Simple responsive mixin: | |
@mixin respond-between($min: 0px, $max: 1920px) { | |
@media only screen and (min-width: $min) and (max-width: $max) { @content; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment