Refactor more docs javascript and add css compilation with gulp.

pull/111/head
Glen Cheney 8 years ago
parent 47556e0c15
commit a044a201fa

@ -34,7 +34,7 @@ defaultTitle: 'Shuffle.js'
defaultDescription: 'Categorize, sort, and filter a responsive grid of items'
defaultImage: '/img/shuffle.png'
longDescription: 'Shuffle.js is a jQuery plugin for sorting, filtering, and laying out a group of items. It’s performant, responsive, and fast. Check out the demos!'
longDescription: 'Shuffle.js is a package for sorting, filtering, and laying out a group of items. It’s performant, responsive, and fast. Check out the demos!'
demos:
- url: 'demos/2013-05-01-basic'

@ -63,13 +63,6 @@ extraJS: [ "faq.js" ]
</div>
</article>
<article id="zepto" class="question js-question">
<div class="question__inner">
<h3 class="question__title">Does Shuffle work with Zepto?</h3>
<p class="question__answer">Not at the moment.</p>
</div>
</article>
<article id="padding" class="question js-question">
<div class="question__inner">
<h3 class="question__title">Padding isn&rsquo;t working on the shuffle element.</h3>

@ -4,7 +4,7 @@ title: Bootstrap 3 Grid Demo
description: Demonstrating how Shuffle can be used with a grid system which uses padding for gutters instead of margins.
image: /demos/bootstrap3grid.jpg
externalCSS: [ "http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" ]
extraJS: [ "demos/bootstrap3grid.js" ]
extraJS: [ "demos/padding-grid.js" ]
---
<style>

@ -13,10 +13,7 @@ pagejs: false
<div class="container-fluid">
<h2>RequireJS!</h2>
<p>
Shuffle is compatible with AMD loaders like <a href="http://requirejs.org">RequireJS</a>.
You can take a peek at the <a href="{{ site.baseurl }}/js/require-main.js">config file</a> used on this page.
Just remember, Shuffle needs Modernizr to work!
I also don't recommend using the "jquery.shuffle.modernizr.js" file with RequireJS because Modernizr doesn't have an AMD defintion block.
Shuffle uses a UMD wrapper, so it is compatible with AMD loaders like <a href="http://requirejs.org">RequireJS</a>. The UMD wrapper also allows Shuffle to work with CommonJS modules. You can take a peek at the <a href="{{ site.baseurl }}/js/require-main.js">config file</a> used on this page.
</p>
</div>

@ -0,0 +1,69 @@
.demo-list .figure-wrap {
position: relative;
z-index: 1;
}
.demo-list .figure-wrap,
.demo-list .figure-wrap img {
// Promote to its own layer. makes filters look ok on retina with images
transform: translateZ(0);
transition: .1s ease;
}
.demo-list:hover .figure-wrap {
transform: scale3d( 1, 1, 1 );
img {
filter: grayscale(1);
}
}
.demo-list:hover .figure-wrap:hover {
z-index: 2;
transform: scale3d( 1.05, 1.05, 1 );
img {
filter: none;
}
}
.demo-list .figure-wrap:nth-child(4n + 1) {
margin-left: 0;
}
.demo-list .figure-wrap > a {
display: block;
}
.demo-list .figure-wrap figcaption {
margin-top: .5em;
margin-bottom: 1em;
}
.demo-link-container::before {
content: '';
color: $emerald;
margin-right: 5px;
}
span.demo-link-container::before {
margin-left: 5px;
}
@media screen and (max-width: 47.9375em) {
.demo-list + .demo-list {
margin-top: 1em;
}
.figure-wrap:nth-child(odd) {
margin-left: 0;
}
.figure-wrap:nth-child(n + 3) {
margin-top: 1em;
}
}

@ -0,0 +1,73 @@
// FAQ
.search-section {
margin-top: 1em;
margin-bottom: 1em;
}
input.faq-search {
-webkit-appearance: searchfield;
box-sizing: border-box;
width: 100%;
border: 2px solid $gray40;
border-radius: 4px;
padding: 0.5em;
font-size: 1.125em;
color: $gray40;
transition: .15s;
&::placeholder {
color: $gray40;
transition: .15s;
}
&:hover {
outline: 0;
color: $gray30;
border-color: $gray30;
&::placeholder {
color: $gray30;
}
}
&:focus {
outline: 0;
color: $nephritis;
border-color: $nephritis;
&::placeholder {
color: $nephritis;
}
}
}
.question {
margin: 2em 0;
overflow: hidden;
transition: .2s ease-out;
}
.question--collapsed {
height: 0 !important; // Needs to override inline style
margin: 0;
border-width: 0;
}
.question--collapsed + .question {
margin-top: 0;
}
.question--unanswered {
padding-top: 1.25em;
border-top: 2px solid $emerald;
}
.question__title {
margin-top: 0;
}
.question__answer {
margin-bottom: 0;
}

@ -0,0 +1,73 @@
*,
*::before,
*::after {
box-sizing: border-box;
}
pre {
max-height: 30em;
}
picture {
display: block;
}
img {
display: block;
max-width: 100%;
height: auto;
}
figure {
margin: 0;
}
ul ul {
padding-left: 1.25em;
margin: 0;
list-style-type: circle;
}
li {
line-height: 1.4;
}
nav > a {
display: block;
margin: 5px 0;
}
.container-fluid {
width: 93%;
max-width: 1200px;
margin-left: auto;
margin-right: auto;
}
.row.row--full {
margin-left: 0;
}
.breathable-list li {
line-height: 1.7;
}
// Filters
.filter__label {
margin: 0 0 3px;
}
.filter__search {
margin: 5px 0;
}
.sort-options {
margin-top: 10px;
}
#be-social {
h2 {
margin-bottom: 32px;
}
}

@ -4,7 +4,7 @@
display: inline-block;
}
.aspect,
.keep-ratio {
position: relative;
width: 100%;
@ -17,15 +17,21 @@
}
}
.aspect--4x3 {
padding-bottom: 75%;
}
.aspect--16x9 {
padding-bottom: 56.25%;
}
// Hide from both screenreaders and browsers: h5bp.com/u
// Hide from both screenreaders and browsers.
.hidden {
display: none !important;
visibility: hidden;
}
// Hide only visually, but have it available for screenreaders: h5bp.com/v
// Hide only visually, but have it available for screenreaders.
.visuallyhidden {
border: 0;
clip: rect(0 0 0 0);
@ -37,40 +43,17 @@
width: 1px;
}
/*
* Clearfix: contain floats
*
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* `contenteditable` attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that receive the `clearfix` class.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
*/
.clearfix:before,
.clearfix:after {
content: " "; /* 1 */
display: table; /* 2 */
}
.clearfix:after {
clear: both;
}
/*
* For IE 6/7 only
* Include this rule to trigger hasLayout and contain floats.
*/
.clearfix {
*zoom: 1;
.clearfix,
.clearfix::after {
content: " ";
display: table;
clear: both;
}
.pull-left {
float: left;
}
.pull-right {
float: right;
}
@ -82,12 +65,6 @@
background-color: transparent;
border: 0;
}
.input-block-level {
display: block;
width: 100%;
min-height: 30px;
box-sizing: border-box;
}
.table-center-wrap {
display: table;

@ -1,293 +0,0 @@
@import "variables";
*,
*::before,
*::after {
box-sizing: border-box;
}
pre {
max-height: 30em;
}
picture {
display: block;
}
img {
display: block;
max-width: 100%;
height: auto;
}
/* lets have some constraints shall we */
.container-fluid {
width: 93%;
max-width: 1200px;
margin-left: auto;
margin-right: auto;
}
.row.row--full {
margin-left: 0;
}
ul ul {
padding-left: 1.25em;
margin: 0;
list-style-type: circle;
}
li {
line-height: 1.4;
}
.breathable-list li {
line-height: 1.7;
}
.site-nav {
.site-nav__title {
color: $clouds;
&:first-child {
margin-top: 0;
}
}
.btn {
width: 100%;
}
.site-nav__tray {
transition: .2s;
overflow: hidden;
height: 300px;
background-color: $wetAsphalt;
}
.site-nav__tray-inner {
padding: 30px 0;
}
&.collapsed .site-nav__tray {
height: 0;
// IE7 wtf
.lt-ie8 & {
display: none;
}
}
.site-nav__band {
position: relative;
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 4px;
background: $wetAsphalt;
}
}
}
.site-footer {
margin-top: 2em;
padding: 1em 0;
background-color: $wetAsphalt;
}
.site-footer__credit {
margin: 0;
text-align: right;
}
nav > a {
display: block;
margin: 5px 0;
}
.demo-list .figure-wrap {
position: relative;
z-index: 1;
}
.demo-list .figure-wrap,
.demo-list .figure-wrap img {
// Promote to its own layer. makes filters look ok on retina with images
transform: translateZ(0);
transition: .1s ease;
}
.demo-list:hover .figure-wrap {
transform: scale3d( 1, 1, 1 );
img {
filter: grayscale(1);
}
}
.demo-list:hover .figure-wrap:hover {
z-index: 2;
transform: scale3d( 1.05, 1.05, 1 );
img {
filter: none;
}
}
.demo-list .figure-wrap:nth-child(4n + 1) {
margin-left: 0;
}
.demo-list .figure-wrap > a {
display: block;
}
.demo-list .figure-wrap figcaption {
margin-top: .5em;
margin-bottom: 1em;
}
.demo-link-container::before {
content: '';
color: $emerald;
margin-right: 5px;
}
span.demo-link-container::before {
margin-left: 5px;
}
// Filters
.filter__label {
margin: 0 0 3px;
}
.filter__search {
margin: 5px 0;
}
.sort-options {
margin-top: 10px;
}
#be-social {
h2 {
margin-bottom: 32px;
}
}
// FAQ
.search-section {
margin-top: 1em;
margin-bottom: 1em;
}
input.faq-search {
width: 100%;
-webkit-appearance: none;
appearance: none;
border: 2px solid $gray40;
border-radius: 4px;
padding: 0.5em;
font-size: 1.125em;
color: $gray40;
transition: .15s;
@include placeholder() {
color: $gray40;
transition: .15s;
}
&:hover {
outline: 0;
color: $gray30;
border-color: $gray30;
@include placeholder() {
color: $gray30;
}
}
&:focus {
outline: 0;
color: $nephritis;
border-color: $nephritis;
@include placeholder() {
color: $nephritis;
}
}
}
.question {
margin: 2em 0;
overflow: hidden;
// For transition
transition: .2s ease-out;
&.collapsed {
height: 0 !important; // Needs to override inline style
margin: 0;
border-width: 0;
}
&.collapsed + .question {
margin-top: 0;
}
}
.question--unanswered {
padding-top: 1.25em;
border-top: 2px solid $emerald;
}
.question__title {
margin-top: 0;
}
.question__answer {
margin-bottom: 0;
}
@media ( max-width: 47.9375em ) {
.demo-list + .demo-list {
margin-top: 1em;
}
.figure-wrap:nth-child(odd) {
margin-left: 0;
}
.figure-wrap:nth-child(n + 3) {
margin-top: 1em;
}
.site-nav .btn {
margin-bottom: 5px;
}
}

@ -1,11 +1,33 @@
/*! normalize.css v2.1.2 | MIT License | git.io/normalize */
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
/* ==========================================================================
HTML5 display definitions
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS and IE text size adjust after device orientation change,
* without disabling user zoom.
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove default margin.
*/
body {
margin: 0;
}
/* HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
* Correct `block` display not defined for any HTML5 element in IE 8/9.
* Correct `block` display not defined for `details` or `summary` in IE 10/11
* and Firefox.
* Correct `block` display not defined for `main` in IE 11.
*/
article,
@ -17,20 +39,24 @@ footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block;
display: block;
}
/**
* Correct `inline-block` display not defined in IE 8/9.
* 1. Correct `inline-block` display not defined in IE 8/9.
* 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
*/
audio,
canvas,
progress,
video {
display: inline-block;
display: inline-block; /* 1 */
vertical-align: baseline; /* 2 */
}
/**
@ -39,110 +65,77 @@ video {
*/
audio:not([controls]) {
display: none;
height: 0;
display: none;
height: 0;
}
/**
* Address styling not present in IE 8/9.
* Address `[hidden]` styling not present in IE 8/9/10.
* Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22.
*/
[hidden] {
display: none;
[hidden],
template {
display: none;
}
/* ==========================================================================
Base
/* Links
========================================================================== */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove default margin.
* Remove the gray background color from active links in IE 10.
*/
body {
margin: 0;
a {
background-color: transparent;
}
/* ==========================================================================
Links
========================================================================== */
/**
* Address `outline` inconsistency between Chrome and other browsers.
*/
a:focus {
outline: thin dotted;
}
/**
* Improve readability when focused and also mouse hovered in all browsers.
* Improve readability of focused elements when they are also in an
* active/hover state.
*/
a:active,
a:hover {
outline: 0;
outline: 0;
}
/* ==========================================================================
Typography
/* Text-level semantics
========================================================================== */
// /**
// * Address variable `h1` font-size and margin within `section` and `article`
// * contexts in Firefox 4+, Safari 5, and Chrome.
// */
// h1 {
// font-size: 2em;
// margin: 0.67em 0;
// }
/**
* Address styling not present in IE 8/9, Safari 5, and Chrome.
* Address styling not present in IE 8/9/10/11, Safari, and Chrome.
*/
abbr[title] {
border-bottom: 1px dotted;
border-bottom: 1px dotted;
}
/**
* Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
* Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
*/
b,
strong {
font-weight: bold;
font-weight: bold;
}
/**
* Address styling not present in Safari 5 and Chrome.
* Address styling not present in Safari and Chrome.
*/
dfn {
font-style: italic;
font-style: italic;
}
/**
* Address differences between Firefox and other browsers.
* Address variable `h1` font-size and margin within `section` and `article`
* contexts in Firefox 4+, Safari, and Chrome.
*/
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/**
@ -150,36 +143,8 @@ hr {
*/
mark {
background: #ff0;
color: #000;
}
/**
* Correct font family set oddly in Safari 5 and Chrome.
*/
code,
kbd,
pre,
samp {
font-family: monospace, serif;
font-size: 1em;
}
/**
* Improve readability of pre-formatted text in all browsers.
*/
pre {
white-space: pre-wrap;
}
/**
* Set consistent quote types.
*/
q {
quotes: "\201C" "\201D" "\2018" "\2019";
background: #ff0;
color: #000;
}
/**
@ -187,7 +152,7 @@ q {
*/
small {
font-size: 80%;
font-size: 80%;
}
/**
@ -196,111 +161,122 @@ small {
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
top: -0.5em;
}
sub {
bottom: -0.25em;
bottom: -0.25em;
}
/* ==========================================================================
Embedded content
/* Embedded content
========================================================================== */
/**
* Remove border when inside `a` element in IE 8/9.
* Remove border when inside `a` element in IE 8/9/10.
*/
img {
border: 0;
border: 0;
}
/**
* Correct overflow displayed oddly in IE 9.
* Correct overflow not hidden in IE 9/10/11.
*/
svg:not(:root) {
overflow: hidden;
overflow: hidden;
}
/* ==========================================================================
Figures
/* Grouping content
========================================================================== */
/**
* Address margin not present in IE 8/9 and Safari 5.
* Address margin not present in IE 8/9 and Safari.
*/
figure {
margin: 0;
margin: 1em 40px;
}
/* ==========================================================================
Forms
========================================================================== */
/**
* Address differences between Firefox and other browsers.
*/
hr {
box-sizing: content-box;
height: 0;
}
/**
* Define consistent border, margin, and padding.
* Contain overflow in all browsers.
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
pre {
overflow: auto;
}
/**
* 1. Correct `color` not being inherited in IE 8/9.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
* Address odd `em`-unit font size rendering in all browsers.
*/
legend {
border: 0; /* 1 */
padding: 0; /* 2 */
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
/* Forms
========================================================================== */
/**
* Known limitation: by default, Chrome and Safari on OS X allow very limited
* styling of `select`, unless a `border` property is set.
*/
/**
* 1. Correct font family not being inherited in all browsers.
* 2. Correct font size not being inherited in all browsers.
* 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
* 1. Correct color not being inherited.
* Known issue: affects color of disabled elements.
* 2. Correct font properties not being inherited.
* 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 2 */
margin: 0; /* 3 */
color: inherit; /* 1 */
font: inherit; /* 2 */
margin: 0; /* 3 */
}
/**
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
* Address `overflow` set to `hidden` in IE 8/9/10/11.
*/
button,
input {
line-height: normal;
button {
overflow: visible;
}
/**
* Address inconsistent `text-transform` inheritance for `button` and `select`.
* All other form control elements do not inherit `text-transform` values.
* Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
* Correct `select` style inheritance in Firefox 4+ and Opera.
* Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
* Correct `select` style inheritance in Firefox.
*/
button,
select {
text-transform: none;
text-transform: none;
}
/**
@ -315,8 +291,8 @@ button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
}
/**
@ -325,60 +301,91 @@ input[type="submit"] {
button[disabled],
html input[disabled] {
cursor: default;
cursor: default;
}
/**
* 1. Address box sizing set to `content-box` in IE 8/9.
* 2. Remove excess padding in IE 8/9.
* Remove inner padding and border in Firefox 4+.
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/**
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
*/
input {
line-height: normal;
}
/**
* It's recommended that you don't attempt to style these elements.
* Firefox's implementation doesn't respect box-sizing, padding, or width.
*
* 1. Address box sizing set to `content-box` in IE 8/9/10.
* 2. Remove excess padding in IE 8/9/10.
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
* Fix the cursor style for Chrome's increment/decrement buttons. For certain
* `font-size` values of the `input`, it causes the cursor style of the
* decrement button to change from `default` to `text`.
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* Remove inner padding and search cancel button in Safari 5 and Chrome
* on OS X.
* Define consistent border, margin, and padding.
*/
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* Remove inner padding and border in Firefox 4+.
* 1. Correct `color` not being inherited in IE 8/9/10/11.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
legend {
border: 0; /* 1 */
padding: 0; /* 2 */
}
/**
* 1. Remove default vertical scrollbar in IE 8/9.
* 2. Improve readability and alignment in all browsers.
* Remove default vertical scrollbar in IE 8/9/10/11.
*/
textarea {
overflow: auto; /* 1 */
vertical-align: top; /* 2 */
overflow: auto;
}
/* ==========================================================================
Tables
/**
* Don't inherit the `font-weight` (applied by a rule above).
* NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
*/
optgroup {
font-weight: bold;
}
/* Tables
========================================================================== */
/**
@ -386,6 +393,11 @@ textarea {
*/
table {
border-collapse: collapse;
border-spacing: 0;
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
padding: 0;
}

@ -0,0 +1,68 @@
.site-nav {
.site-nav__title {
color: $clouds;
&:first-child {
margin-top: 0;
}
}
.btn {
width: 100%;
}
.site-nav__tray {
transition: .2s;
overflow: hidden;
height: 300px;
background-color: $wetAsphalt;
}
.site-nav__tray-inner {
padding: 30px 0;
}
&.collapsed .site-nav__tray {
height: 0;
// IE7 wtf
.lt-ie8 & {
display: none;
}
}
.site-nav__band {
position: relative;
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 4px;
background: $wetAsphalt;
}
}
}
.site-footer {
margin-top: 2em;
padding: 1em 0;
background-color: $wetAsphalt;
}
.site-footer__credit {
margin: 0;
text-align: right;
}
@media screen and (max-width: 47.9375em) {
.site-nav .btn {
margin-bottom: 5px;
}
}

@ -44,28 +44,9 @@ $white: #FFF;
@mixin clearfix() {
&:before,
&:after {
&::after {
content: " ";
display: table;
}
&:after {
clear: both;
}
& {
*zoom: 1;
}
}
@mixin placeholder() {
&::-webkit-input-placeholder {
@content;
}
&::-moz-input-placeholder {
@content;
}
}

@ -3,6 +3,9 @@
@import "type";
@import "bootstrap";
@import "mobile-grid";
@import "main";
@import "global";
@import "site-nav";
@import "demo-list";
@import "faq";
@import "buttons";
@import "helpers";

@ -4,10 +4,12 @@
.filter-group .filter-group__label {
margin: 0 0 5px; }
.filter-group button {
width: 40px;
height: 40px;
padding: 0; }
.filter-group label {
cursor: pointer; }
@ -19,19 +21,19 @@
position: relative;
margin-left: 0;
margin-top: 10px; }
.shape .shape__inner {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0; }
.shape .shape__space {
width: 100%;
height: 100%;
background-color: black;
border-style: solid;
border-width: 0;
border-color: transparent; }
.shape .shape__inner {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0; }
.shape .shape__space {
width: 100%;
height: 100%;
background-color: black;
border-style: solid;
border-width: 0;
border-color: transparent; }
.shape--blue .shape__space {
background-color: #3498DB;
@ -53,9 +55,7 @@
border-radius: 50%; }
.shape--diamond .shape__space {
-webkit-transform: rotate(45deg) scale(0.70711);
-ms-transform: rotate(45deg) scale(0.70711);
transform: rotate(45deg) scale(0.70711); }
transform: rotate(45deg) scale(0.70711); }
.shape--triangle .shape__space {
padding-top: 14.5px;
@ -70,6 +70,7 @@
height: 250px;
overflow: visible;
padding-bottom: 0; }
.lt-ie9 .shape .shape__inner {
position: static;
width: 100%;
@ -81,12 +82,14 @@
height: 0;
width: 0;
border-width: 0 135px 234px 135px; } }
@media (min-width: 768px) and (max-width: 979px) {
.shape--triangle .shape__space {
padding-top: 11px;
height: 0;
width: 0;
border-width: 0 83px 144px 83px; } }
@media (max-width: 767px) {
.shape--triangle .shape__space {
padding-top: 40px;
@ -94,18 +97,21 @@
width: 0;
border-width: 0 300px 520px 300px;
margin: auto; } }
@media (max-width: 600px) {
.shape--triangle .shape__space {
padding-top: 32px;
height: 0;
width: 0;
border-width: 0 240px 416px 240px; } }
@media (max-width: 480px) {
.shape--triangle .shape__space {
padding-top: 21.5px;
height: 0;
width: 0;
border-width: 0 160px 277px 160px; } }
body::before {
content: 'Default - 940px';
position: fixed;
@ -115,21 +121,23 @@ body::before {
width: 100%;
height: 25px;
background-color: rgba(119, 204, 102, 0.6);
-webkit-transition: background .2s ease;
transition: background .2s ease; }
transition: background .2s ease; }
@media (min-width: 1200px) {
body::before {
content: 'Large Desktop - 1200px+';
background-color: rgba(204, 119, 102, 0.6); } }
@media (min-width: 768px) and (max-width: 979px) {
body::before {
content: 'Portrait tablet to landscape and desktop - > 768px && < 979px';
background-color: rgba(204, 187, 102, 0.6); } }
@media (max-width: 767px) {
body::before {
content: 'Phones to Tablets - < 767px';
background-color: rgba(102, 153, 204, 0.6); } }
@media (max-width: 480px) {
body::before {
content: 'Phones - < 480px';

@ -1,44 +1,44 @@
/*=============================================*\
Some styles to show off masonry layout
/*=============================================* Some styles to show off masonry layout
\*=============================================*/
.picture-item {
height: 220px;
margin-top: 24px; }
.picture-item.shuffle-item {
margin-left: 0
/* shuffle items shouldn't have a left margin*/ }
.picture-item.picture-item--h2 {
height: 464px
/* 2x the height + 1 gutter */ }
.picture-item.span6:not(.picture-item--h2) .picture-item__details {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
background-color: #333;
background-color: rgba(0, 0, 0, 0.6);
color: white;
overflow: hidden; }
.picture-item.span6:not(.picture-item--h2) .picture-item__description {
display: none; }
.picture-item .picture-item__inner {
background: #ECF0F1;
height: 100%;
overflow: hidden; }
.picture-item img {
display: block;
width: 100%;
height: auto; }
.picture-item .picture-item__blur {
display: none; }
.picture-item .picture-item__details, .picture-item .picture-item__description {
padding: 1em; }
.picture-item .picture-item__description {
margin: 0;
padding-top: 0;
padding-right: 2em; }
.picture-item .picture-item__tags {
margin: 0; }
.picture-item.shuffle-item {
margin-left: 0;
/* shuffle items shouldn't have a left margin*/ }
.picture-item.picture-item--h2 {
height: 464px;
/* 2x the height + 1 gutter */ }
.picture-item.span6:not(.picture-item--h2) .picture-item__details {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
background-color: #333;
background-color: rgba(0, 0, 0, 0.6);
color: white;
overflow: hidden; }
.picture-item.span6:not(.picture-item--h2) .picture-item__description {
display: none; }
.picture-item .picture-item__inner {
background: #ECF0F1;
height: 100%;
overflow: hidden; }
.picture-item img {
display: block;
width: 100%;
height: auto; }
.picture-item .picture-item__blur {
display: none; }
.picture-item .picture-item__details,
.picture-item .picture-item__description {
padding: 1em; }
.picture-item .picture-item__description {
margin: 0;
padding-top: 0;
padding-right: 2em; }
.picture-item .picture-item__tags {
margin: 0; }
/* autoprefixer: off */
@supports (filter: blur(1px)) or (-webkit-filter: blur(1px)) {
@ -49,13 +49,14 @@
top: calc(50px - 220px);
left: 0;
display: block;
-webkit-filter: blur(7px);
filter: blur(7px); }
filter: blur(7px); }
.picture-item.span6:not(.picture-item--h2) .picture-item__details {
background: none; }
.picture-item.span6:not(.picture-item--h2) .picture-item__tags, .picture-item.span6:not(.picture-item--h2) .picture-item__title {
.picture-item.span6:not(.picture-item--h2) .picture-item__tags,
.picture-item.span6:not(.picture-item--h2) .picture-item__title {
position: relative;
z-index: 2; } }
/*
Shuffle needs either relative or absolute positioning on the container
It will set it for you, but it'll cause another style recalculation and layout.
@ -89,17 +90,17 @@
.picture-item {
height: auto;
margin-top: 20px; }
.picture-item.picture-item--h2 {
height: auto; }
.picture-item .picture-item__details, .picture-item .picture-item__description {
font-size: .875em;
padding: .625em; }
.picture-item .picture-item__description {
padding-right: .875em;
padding-bottom: 1.25em; }
.filter > .row-fluid, .filter > .row-fluid > div {
.picture-item.picture-item--h2 {
height: auto; }
.picture-item .picture-item__details,
.picture-item .picture-item__description {
font-size: .875em;
padding: .625em; }
.picture-item .picture-item__description {
padding-right: .875em;
padding-bottom: 1.25em; }
.filter > .row-fluid,
.filter > .row-fluid > div {
margin: 10px 0; }
.m-nofloat {
float: none; } }

File diff suppressed because it is too large Load Diff

@ -4,6 +4,7 @@ const gulp = require('gulp');
const gutil = require('gulp-util');
const webpack = require('webpack');
const shell = require('gulp-shell');
const sass = require('gulp-sass');
let config = {
watch: false,
@ -44,9 +45,20 @@ function jekyll() {
function setWatching(done) {
config.watch = true;
gulp.watch('_scss/*.scss', css);
done();
}
function css() {
return gulp.src([
'./_scss/gallery.scss',
'./_scss/shuffle-styles.scss',
'./_scss/style.scss',
])
.pipe(sass())
.pipe(gulp.dest('./css/'));
}
// function test() {
// return gulp.src('test/specs.js')
// .pipe(jasmine());
@ -56,11 +68,12 @@ function setWatching(done) {
gulp.task('scripts', compile);
gulp.task('set-watching', setWatching);
gulp.task(css);
gulp.task(jekyll);
gulp.task('watch', gulp.series(
'set-watching',
'scripts',
gulp.parallel('css', 'scripts'),
'jekyll'
));

@ -1,99 +1,77 @@
var DEMO = (function( $, Viewport ) {
'use strict';
'use strict';
var $grid = $('#grid'),
$gridItems = $grid.find('.picture-item'),
$sizer = $grid.find('.shuffle__sizer'),
shuffle,
var Shuffle = window.shuffle;
var Viewport = window.viewport;
init = function() {
function toArray(arrayLike) {
if ('from' in Array) {
return Array.from(arrayLike);
}
return Array.prototype.slice.call(arrayLike);
}
// instantiate the plugin
$grid.shuffle({
itemSelector: '.picture-item',
sizer: $sizer
});
shuffle = $grid.data('shuffle');
addViewportItems();
setTimeout(function() {
listen();
addTransitionToItems();
}, 100);
},
addViewportItems = function() {
$gridItems.each(function() {
Viewport.add({
element: this,
threshold: 130,
enter: showItemsInViewport
});
});
},
// Only the items out of the viewport should transition. This way, the first visible ones
// will snap into place.
addTransitionToItems = function() {
$gridItems.find('.picture-item__inner').addClass('picture-item__inner--transition');
},
showItemsInViewport = function() {
$(this).addClass('in');
},
var Demo = function () {
this.element = document.getElementById('grid');
this.gridItems = toArray(this.element.querySelectorAll('.picture-item'));
this.sizer = this.element.querySelector('.shuffle__sizer');
// Re layout shuffle when images load. This is only needed
// below 768 pixels because the .picture-item height is auto and therefore
// the height of the picture-item is dependent on the image
// I recommend using imagesloaded to determine when an image is loaded
// but that doesn't support IE7
listen = function() {
this.shuffle = new Shuffle(this.element, {
itemSelector: '.picture-item',
sizer: this.sizer,
});
var debouncedLayout = $.throttle( 300, function() {
$grid.shuffle('update');
Viewport.refresh();
});
var $imgs = $grid.find('img');
this.addViewportItems();
// Get all images inside shuffle
$imgs.each(function() {
var proxyImage;
setTimeout(function () {
this.addTransitionToItems();
}.bind(this), 100);
};
// Image already loaded
if ( this.complete && this.naturalWidth !== undefined ) {
return;
}
Demo.prototype.addViewportItems = function () {
var handler = this.showItemsInViewport;
// If none of the checks above matched, simulate loading on detached element.
proxyImage = new Image();
$( proxyImage ).on('load', function() {
$(this).off('load');
debouncedLayout();
});
proxyImage.src = this.src;
this.gridItems.forEach(function () {
Viewport.add({
element: this,
threshold: 130,
enter: handler,
});
// Because this method doesn't seem to be perfect.
setTimeout(function() {
debouncedLayout();
}, 500);
};
return {
init: init,
getShuffle: function() {
return shuffle;
}
};
}( jQuery, window.Viewport ));
$(document).ready(function() {
DEMO.init();
});
};
Demo.prototype.showItemsInViewport = function () {
this.classList.add('in');
};
/**
* Only the items out of the viewport should transition. This way, the first
* visible ones will snap into place.
*/
Demo.prototype.addTransitionToItems = function () {
this.gridItems.forEach(function (item) {
item.querySelector('.picture-item__inner').classList.add('picture-item__inner--transition');
});
};
/**
* Re-layout shuffle when images load. This is only needed below 768 pixels
* because the .picture-item height is auto and therefore the height of the
* picture-item is dependent on the image. I recommend using imagesloaded by
* desandro to determine when all your images have loaded.
*/
Demo.prototype.listenForImageLoads = function () {
var imgs = this.element.querySelectorAll('img');
var handler = function () {
this.shuffle.update();
Viewport.refresh();
}.bind(this);
for (var i = imgs.length - 1; i >= 0; i--) {
imgs[i].addEventListener('load', handler, false);
}
};
document.addEventListener('DOMContentLoaded', function () {
window.demo = new Demo();
});

@ -1,22 +0,0 @@
var DEMO = (function( $ ) {
'use strict';
var init = function() {
var $grid = $('#grid'),
$sizer = $grid.find('.shuffle__sizer');
$grid.shuffle({
itemSelector: '.grid__brick',
sizer: $sizer
});
};
return {
init: init
};
}( jQuery ));
$(document).ready(function() {
DEMO.init();
});

@ -0,0 +1,6 @@
'use strict';
window.demo = new window.shuffle(document.getElementById('grid'), {
itemSelector: '.grid__brick',
sizer: document.querySelector('#grid .shuffle__sizer'),
});

@ -60,6 +60,8 @@ window.evenHeights = (function () {
groups.forEach(function (elements, i) {
setAllHeights(elements, tallests[i] + 'px');
});
return tallests;
}
return evenHeights;

@ -1,69 +1,59 @@
(function () {
'use strict';
// Requires jQuery and jQuery.debounce
var Questions = function () {
this.searchInput = document.querySelector('#search');
this.questions = document.querySelectorAll('.js-question');
(function( $ ) {
if (!this.searchInput) {
return;
}
var collapsedClass = 'collapsed',
$searchInput = $('#search'),
$questions = $('.js-question'),
$questionInners = $questions.find('.question__inner'),
$questionTitles = $questions.find('.question__title'),
var handler = this._handleInput.bind(this);
this.searchInput.addEventListener('keyup', handler);
this.searchInput.addEventListener('change', handler);
window.addEventListener('resize', this.onWindowResize.bind(this));
keyup = function() {
// Value they've entered
var val = this.value.toLowerCase();
this.setHeights();
};
Questions.prototype._handleInput = function (evt) {
var val = evt.target.value.toLowerCase();
// Filter elements based on if their string exists in the product model
$questions.each(function( i, el ) {
var $el = $( el ),
text = $.trim( $questionTitles.eq( i ).text() ).toLowerCase(),
passes = text.indexOf( val ) !== -1;
for (var i = 0, len = this.questions.length; i < len; i++) {
var el = this.questions[i];
var title = el.querySelector('.question__title').textContent;
var text = title.trim().toLowerCase();
if ( passes ) {
if ( $el.hasClass( collapsedClass ) ) {
$el.removeClass( collapsedClass );
}
if (text.indexOf(val) === -1) {
el.classList.add('question--collapsed');
} else {
if ( !$el.hasClass( collapsedClass ) ) {
$el.addClass( collapsedClass );
}
el.classList.remove('question--collapsed');
}
}
};
});
},
debouncedKeyup = $.debounce( 100, keyup ),
// Height cannot be transitioned from auto to zero, so it must be set.
setHeights = function() {
var heights = [];
// Remove current hegith
$questions.css( 'height', '' );
Questions.prototype.setHeights = function () {
var elements = [].slice.call(this.questions);
// Get new heights
// Inner div needed because setting a height on the elements
// self doesn't get the correct new height :\
$questionInners.each(function() {
heights.push( $( this ).css( 'height' ) );
elements.forEach(function (element) {
element.style.height = '';
});
// Set new heights
$questions.each(function( i ) {
$( this ).css( 'height', heights[ i ] );
var heights = elements.map(function (element) {
return element.firstElementChild.offsetHeight;
});
},
onWindowResize = function() {
setHeights();
elements.forEach(function (element, i) {
element.style.height = heights[i] + 'px';
});
};
if ( !$searchInput.length ) {
return;
}
Questions.prototype.onWindowResize = function () {
this.setHeights();
};
$searchInput.on( 'keyup change', debouncedKeyup );
$( window ).on( 'resize', $.debounce( 250, onWindowResize ) );
onWindowResize();
new Questions();
}());
}( jQuery ));

@ -1,26 +1,5 @@
'use strict';
/*
* jQuery throttle / debounce - v1.1 - 3/7/2010
* http://benalman.com/projects/jquery-throttle-debounce-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
// (function (b, c) {
// var $ = b.jQuery || b.Cowboy || (b.Cowboy = {}), a;$.throttle = a = function (e, f, j, i) {
// var h, d = 0;if (typeof f !== 'boolean') {
// i = j;j = f;f = c;
// }function g() {
// var o = this, m = +new Date() - d, n = arguments;function l() {
// d = +new Date();j.apply(o, n);
// }function k() {h = c;}if (i && !h) {l();}h && clearTimeout(h);if (i === c && m > e) {l();}else {if (f !== true) {h = setTimeout(i ? k : l, i === c ? e - m : e);}}
// }if ($.guid) {g.guid = j.guid = j.guid || $.guid++;}return g;
// };$.debounce = function (d, e, f) {return f === c ? a(d, e, false) : a(d, f, e !== false);};
// })(this);
var Modules = {};
Modules.NavTray = (function () {
@ -269,7 +248,7 @@ document.addEventListener('DOMContentLoaded', function () {
// Only animate the favicon on the homepage so that
// timeline tests aren't filled with junk
if (true || window.location.pathname === '/Shuffle/') {
if (window.location.pathname === '/Shuffle/') {
var src = site_url + '/img/favicon-sprite.png';
new Modules.Favicon(src, 21, 7, 3000 * 1);
}

@ -1,51 +1,45 @@
requirejs.config({
baseUrl: site_url + '/js',
paths: {
jquery: '//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min',
shuffle: '../dist/jquery.shuffle',
modernizr: '../dist/modernizr.custom.min'
shuffle: '../dist/shuffle',
},
// Shimming other page javascript.
shim: {
evenheights: {
deps: ['jquery'],
exports: 'jQuery.fn.evenHeights'
},
page: {
deps: ['jquery', 'evenheights'],
exports: 'Modules'
}
}
deps: ['evenheights'],
exports: 'Modules',
},
},
});
// A hack for Modernizr and AMD. This lets Modernizr be in the <head> and also
// compatible with other modules.
define('modernizr', [], window.Modernizr);
define(function(require) {
// Get jQuery.
var $ = require('jquery');
define(function (require) {
'use strict';
// Get Shuffle.
var Shuffle = require('shuffle');
// Page-level JavaScript used for the demo pages.
var jqEvenHeights = require('evenheights');
var Page = require('page');
require('evenheights');
require('page');
// Create a new shuffle instance.
var shuffle = new Shuffle($('#grid').get(0), {
var element = document.getElementById('grid');
var shuffle = new Shuffle(element, {
itemSelector: '.js-item',
sizer: $('#js-sizer')
sizer: document.getElementById('js-sizer'),
});
// DO NOT use this for determining when images load.
// See http://vestride.github.io/Shuffle/images/
// Use something like imagesLoaded.
$('#grid img').on('load', function() {
shuffle.layout();
});
var imgs = this.element.querySelectorAll('img');
var handler = function () {
shuffle.update();
};
for (var i = imgs.length - 1; i >= 0; i--) {
imgs[i].addEventListener('load', handler, false);
}
});

Loading…
Cancel
Save