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' defaultDescription: 'Categorize, sort, and filter a responsive grid of items'
defaultImage: '/img/shuffle.png' 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: demos:
- url: 'demos/2013-05-01-basic' - url: 'demos/2013-05-01-basic'

@ -63,13 +63,6 @@ extraJS: [ "faq.js" ]
</div> </div>
</article> </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"> <article id="padding" class="question js-question">
<div class="question__inner"> <div class="question__inner">
<h3 class="question__title">Padding isn&rsquo;t working on the shuffle element.</h3> <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. description: Demonstrating how Shuffle can be used with a grid system which uses padding for gutters instead of margins.
image: /demos/bootstrap3grid.jpg image: /demos/bootstrap3grid.jpg
externalCSS: [ "http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" ] externalCSS: [ "http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" ]
extraJS: [ "demos/bootstrap3grid.js" ] extraJS: [ "demos/padding-grid.js" ]
--- ---
<style> <style>

@ -13,10 +13,7 @@ pagejs: false
<div class="container-fluid"> <div class="container-fluid">
<h2>RequireJS!</h2> <h2>RequireJS!</h2>
<p> <p>
Shuffle is compatible with AMD loaders like <a href="http://requirejs.org">RequireJS</a>. 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.
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.
</p> </p>
</div> </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; display: inline-block;
} }
.aspect,
.keep-ratio { .keep-ratio {
position: relative; position: relative;
width: 100%; 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 { .hidden {
display: none !important; display: none !important;
visibility: hidden; visibility: hidden;
} }
// Hide only visually, but have it available for screenreaders: h5bp.com/v // Hide only visually, but have it available for screenreaders.
.visuallyhidden { .visuallyhidden {
border: 0; border: 0;
clip: rect(0 0 0 0); clip: rect(0 0 0 0);
@ -37,40 +43,17 @@
width: 1px; width: 1px;
} }
/* .clearfix,
* Clearfix: contain floats .clearfix::after {
* content: " ";
* For modern browsers display: table;
* 1. The space content is one way to avoid an Opera bug when the clear: both;
* `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;
} }
.pull-left { .pull-left {
float: left; float: left;
} }
.pull-right { .pull-right {
float: right; float: right;
} }
@ -82,12 +65,6 @@
background-color: transparent; background-color: transparent;
border: 0; border: 0;
} }
.input-block-level {
display: block;
width: 100%;
min-height: 30px;
box-sizing: border-box;
}
.table-center-wrap { .table-center-wrap {
display: table; 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, article,
@ -17,20 +39,24 @@ footer,
header, header,
hgroup, hgroup,
main, main,
menu,
nav, nav,
section, section,
summary { 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, audio,
canvas, canvas,
progress,
video { video {
display: inline-block; display: inline-block; /* 1 */
vertical-align: baseline; /* 2 */
} }
/** /**
@ -39,110 +65,77 @@ video {
*/ */
audio:not([controls]) { audio:not([controls]) {
display: none; display: none;
height: 0; 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] { [hidden],
display: none; template {
display: none;
} }
/* ========================================================================== /* Links
Base
========================================================================== */ ========================================================================== */
/** /**
* 1. Set default font family to sans-serif. * Remove the gray background color from active links in IE 10.
* 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.
*/ */
body { a {
margin: 0; background-color: transparent;
} }
/* ==========================================================================
Links
========================================================================== */
/** /**
* Address `outline` inconsistency between Chrome and other browsers. * Improve readability of focused elements when they are also in an
*/ * active/hover state.
a:focus {
outline: thin dotted;
}
/**
* Improve readability when focused and also mouse hovered in all browsers.
*/ */
a:active, a:active,
a:hover { a:hover {
outline: 0; outline: 0;
} }
/* ========================================================================== /* Text-level semantics
Typography
========================================================================== */ ========================================================================== */
// /**
// * 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] { 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, b,
strong { 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 { 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 { h1 {
-moz-box-sizing: content-box; font-size: 2em;
box-sizing: content-box; margin: 0.67em 0;
height: 0;
} }
/** /**
@ -150,36 +143,8 @@ hr {
*/ */
mark { mark {
background: #ff0; background: #ff0;
color: #000; 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";
} }
/** /**
@ -187,7 +152,7 @@ q {
*/ */
small { small {
font-size: 80%; font-size: 80%;
} }
/** /**
@ -196,111 +161,122 @@ small {
sub, sub,
sup { sup {
font-size: 75%; font-size: 75%;
line-height: 0; line-height: 0;
position: relative; position: relative;
vertical-align: baseline; vertical-align: baseline;
} }
sup { sup {
top: -0.5em; top: -0.5em;
} }
sub { 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 { img {
border: 0; border: 0;
} }
/** /**
* Correct overflow displayed oddly in IE 9. * Correct overflow not hidden in IE 9/10/11.
*/ */
svg:not(:root) { svg:not(:root) {
overflow: hidden; overflow: hidden;
} }
/* ========================================================================== /* Grouping content
Figures
========================================================================== */ ========================================================================== */
/** /**
* Address margin not present in IE 8/9 and Safari 5. * Address margin not present in IE 8/9 and Safari.
*/ */
figure { 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 { pre {
border: 1px solid #c0c0c0; overflow: auto;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
} }
/** /**
* 1. Correct `color` not being inherited in IE 8/9. * Address odd `em`-unit font size rendering in all browsers.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/ */
legend { code,
border: 0; /* 1 */ kbd,
padding: 0; /* 2 */ 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. * 1. Correct color not being inherited.
* 2. Correct font size not being inherited in all browsers. * Known issue: affects color of disabled elements.
* 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome. * 2. Correct font properties not being inherited.
* 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
*/ */
button, button,
input, input,
optgroup,
select, select,
textarea { textarea {
font-family: inherit; /* 1 */ color: inherit; /* 1 */
font-size: 100%; /* 2 */ font: inherit; /* 2 */
margin: 0; /* 3 */ margin: 0; /* 3 */
} }
/** /**
* Address Firefox 4+ setting `line-height` on `input` using `!important` in * Address `overflow` set to `hidden` in IE 8/9/10/11.
* the UA stylesheet.
*/ */
button, button {
input { overflow: visible;
line-height: normal;
} }
/** /**
* Address inconsistent `text-transform` inheritance for `button` and `select`. * Address inconsistent `text-transform` inheritance for `button` and `select`.
* All other form control elements do not inherit `text-transform` values. * All other form control elements do not inherit `text-transform` values.
* Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+. * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
* Correct `select` style inheritance in Firefox 4+ and Opera. * Correct `select` style inheritance in Firefox.
*/ */
button, button,
select { select {
text-transform: none; text-transform: none;
} }
/** /**
@ -315,8 +291,8 @@ button,
html input[type="button"], /* 1 */ html input[type="button"], /* 1 */
input[type="reset"], input[type="reset"],
input[type="submit"] { input[type="submit"] {
-webkit-appearance: button; /* 2 */ -webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */ cursor: pointer; /* 3 */
} }
/** /**
@ -325,60 +301,91 @@ input[type="submit"] {
button[disabled], button[disabled],
html input[disabled] { html input[disabled] {
cursor: default; cursor: default;
} }
/** /**
* 1. Address box sizing set to `content-box` in IE 8/9. * Remove inner padding and border in Firefox 4+.
* 2. Remove excess padding in IE 8/9. */
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="checkbox"],
input[type="radio"] { input[type="radio"] {
box-sizing: border-box; /* 1 */ box-sizing: border-box; /* 1 */
padding: 0; /* 2 */ 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"] { input[type="number"]::-webkit-inner-spin-button,
-webkit-appearance: textfield; /* 1 */ input[type="number"]::-webkit-outer-spin-button {
height: auto;
} }
/** /**
* Remove inner padding and search cancel button in Safari 5 and Chrome * Define consistent border, margin, and padding.
* on OS X.
*/ */
input[type="search"]::-webkit-search-cancel-button, fieldset {
input[type="search"]::-webkit-search-decoration { border: 1px solid #c0c0c0;
-webkit-appearance: none; 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, legend {
input::-moz-focus-inner { border: 0; /* 1 */
border: 0; padding: 0; /* 2 */
padding: 0;
} }
/** /**
* 1. Remove default vertical scrollbar in IE 8/9. * Remove default vertical scrollbar in IE 8/9/10/11.
* 2. Improve readability and alignment in all browsers.
*/ */
textarea { textarea {
overflow: auto; /* 1 */ overflow: auto;
vertical-align: top; /* 2 */
} }
/* ========================================================================== /**
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 { table {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; 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() { @mixin clearfix() {
&:before, &::after {
&:after {
content: " "; content: " ";
display: table; display: table;
}
&:after {
clear: both; clear: both;
} }
& {
*zoom: 1;
}
} }
@mixin placeholder() {
&::-webkit-input-placeholder {
@content;
}
&::-moz-input-placeholder {
@content;
}
}

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

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

@ -1,44 +1,44 @@
/*=============================================*\ /*=============================================* Some styles to show off masonry layout
Some styles to show off masonry layout
\*=============================================*/ \*=============================================*/
.picture-item { .picture-item {
height: 220px; height: 220px;
margin-top: 24px; } margin-top: 24px; }
.picture-item.shuffle-item { .picture-item.shuffle-item {
margin-left: 0 margin-left: 0;
/* shuffle items shouldn't have a left margin*/ } /* shuffle items shouldn't have a left margin*/ }
.picture-item.picture-item--h2 { .picture-item.picture-item--h2 {
height: 464px height: 464px;
/* 2x the height + 1 gutter */ } /* 2x the height + 1 gutter */ }
.picture-item.span6:not(.picture-item--h2) .picture-item__details { .picture-item.span6:not(.picture-item--h2) .picture-item__details {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%; width: 100%;
background-color: #333; background-color: #333;
background-color: rgba(0, 0, 0, 0.6); background-color: rgba(0, 0, 0, 0.6);
color: white; color: white;
overflow: hidden; } overflow: hidden; }
.picture-item.span6:not(.picture-item--h2) .picture-item__description { .picture-item.span6:not(.picture-item--h2) .picture-item__description {
display: none; } display: none; }
.picture-item .picture-item__inner { .picture-item .picture-item__inner {
background: #ECF0F1; background: #ECF0F1;
height: 100%; height: 100%;
overflow: hidden; } overflow: hidden; }
.picture-item img { .picture-item img {
display: block; display: block;
width: 100%; width: 100%;
height: auto; } height: auto; }
.picture-item .picture-item__blur { .picture-item .picture-item__blur {
display: none; } display: none; }
.picture-item .picture-item__details, .picture-item .picture-item__description { .picture-item .picture-item__details,
padding: 1em; } .picture-item .picture-item__description {
.picture-item .picture-item__description { padding: 1em; }
margin: 0; .picture-item .picture-item__description {
padding-top: 0; margin: 0;
padding-right: 2em; } padding-top: 0;
.picture-item .picture-item__tags { padding-right: 2em; }
margin: 0; } .picture-item .picture-item__tags {
margin: 0; }
/* autoprefixer: off */ /* autoprefixer: off */
@supports (filter: blur(1px)) or (-webkit-filter: blur(1px)) { @supports (filter: blur(1px)) or (-webkit-filter: blur(1px)) {
@ -49,13 +49,14 @@
top: calc(50px - 220px); top: calc(50px - 220px);
left: 0; left: 0;
display: block; display: block;
-webkit-filter: blur(7px); filter: blur(7px); }
filter: blur(7px); }
.picture-item.span6:not(.picture-item--h2) .picture-item__details { .picture-item.span6:not(.picture-item--h2) .picture-item__details {
background: none; } 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; position: relative;
z-index: 2; } } z-index: 2; } }
/* /*
Shuffle needs either relative or absolute positioning on the container 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. It will set it for you, but it'll cause another style recalculation and layout.
@ -89,17 +90,17 @@
.picture-item { .picture-item {
height: auto; height: auto;
margin-top: 20px; } margin-top: 20px; }
.picture-item.picture-item--h2 { .picture-item.picture-item--h2 {
height: auto; } height: auto; }
.picture-item .picture-item__details, .picture-item .picture-item__description { .picture-item .picture-item__details,
font-size: .875em; .picture-item .picture-item__description {
padding: .625em; } font-size: .875em;
.picture-item .picture-item__description { padding: .625em; }
padding-right: .875em; .picture-item .picture-item__description {
padding-bottom: 1.25em; } padding-right: .875em;
padding-bottom: 1.25em; }
.filter > .row-fluid, .filter > .row-fluid > div { .filter > .row-fluid,
.filter > .row-fluid > div {
margin: 10px 0; } margin: 10px 0; }
.m-nofloat { .m-nofloat {
float: none; } } 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 gutil = require('gulp-util');
const webpack = require('webpack'); const webpack = require('webpack');
const shell = require('gulp-shell'); const shell = require('gulp-shell');
const sass = require('gulp-sass');
let config = { let config = {
watch: false, watch: false,
@ -44,9 +45,20 @@ function jekyll() {
function setWatching(done) { function setWatching(done) {
config.watch = true; config.watch = true;
gulp.watch('_scss/*.scss', css);
done(); done();
} }
function css() {
return gulp.src([
'./_scss/gallery.scss',
'./_scss/shuffle-styles.scss',
'./_scss/style.scss',
])
.pipe(sass())
.pipe(gulp.dest('./css/'));
}
// function test() { // function test() {
// return gulp.src('test/specs.js') // return gulp.src('test/specs.js')
// .pipe(jasmine()); // .pipe(jasmine());
@ -56,11 +68,12 @@ function setWatching(done) {
gulp.task('scripts', compile); gulp.task('scripts', compile);
gulp.task('set-watching', setWatching); gulp.task('set-watching', setWatching);
gulp.task(css);
gulp.task(jekyll); gulp.task(jekyll);
gulp.task('watch', gulp.series( gulp.task('watch', gulp.series(
'set-watching', 'set-watching',
'scripts', gulp.parallel('css', 'scripts'),
'jekyll' 'jekyll'
)); ));

@ -1,99 +1,77 @@
var DEMO = (function( $, Viewport ) { 'use strict';
'use strict';
var $grid = $('#grid'), var Shuffle = window.shuffle;
$gridItems = $grid.find('.picture-item'), var Viewport = window.viewport;
$sizer = $grid.find('.shuffle__sizer'),
shuffle,
init = function() { function toArray(arrayLike) {
if ('from' in Array) {
return Array.from(arrayLike);
}
return Array.prototype.slice.call(arrayLike);
}
// instantiate the plugin var Demo = function () {
$grid.shuffle({ this.element = document.getElementById('grid');
itemSelector: '.picture-item', this.gridItems = toArray(this.element.querySelectorAll('.picture-item'));
sizer: $sizer this.sizer = this.element.querySelector('.shuffle__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');
},
// Re layout shuffle when images load. This is only needed this.shuffle = new Shuffle(this.element, {
// below 768 pixels because the .picture-item height is auto and therefore itemSelector: '.picture-item',
// the height of the picture-item is dependent on the image sizer: this.sizer,
// I recommend using imagesloaded to determine when an image is loaded });
// but that doesn't support IE7
listen = function() {
var debouncedLayout = $.throttle( 300, function() { this.addViewportItems();
$grid.shuffle('update');
Viewport.refresh();
});
var $imgs = $grid.find('img');
// Get all images inside shuffle setTimeout(function () {
$imgs.each(function() { this.addTransitionToItems();
var proxyImage; }.bind(this), 100);
};
// Image already loaded Demo.prototype.addViewportItems = function () {
if ( this.complete && this.naturalWidth !== undefined ) { var handler = this.showItemsInViewport;
return;
}
// If none of the checks above matched, simulate loading on detached element. this.gridItems.forEach(function () {
proxyImage = new Image(); Viewport.add({
$( proxyImage ).on('load', function() { element: this,
$(this).off('load'); threshold: 130,
debouncedLayout(); enter: handler,
});
proxyImage.src = this.src;
}); });
});
// Because this method doesn't seem to be perfect. };
setTimeout(function() {
debouncedLayout(); Demo.prototype.showItemsInViewport = function () {
}, 500); this.classList.add('in');
}; };
return { /**
init: init, * Only the items out of the viewport should transition. This way, the first
getShuffle: function() { * visible ones will snap into place.
return shuffle; */
} Demo.prototype.addTransitionToItems = function () {
}; this.gridItems.forEach(function (item) {
}( jQuery, window.Viewport )); item.querySelector('.picture-item__inner').classList.add('picture-item__inner--transition');
});
};
$(document).ready(function() { /**
DEMO.init(); * 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) { groups.forEach(function (elements, i) {
setAllHeights(elements, tallests[i] + 'px'); setAllHeights(elements, tallests[i] + 'px');
}); });
return tallests;
} }
return evenHeights; 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', var handler = this._handleInput.bind(this);
$searchInput = $('#search'), this.searchInput.addEventListener('keyup', handler);
$questions = $('.js-question'), this.searchInput.addEventListener('change', handler);
$questionInners = $questions.find('.question__inner'), window.addEventListener('resize', this.onWindowResize.bind(this));
$questionTitles = $questions.find('.question__title'),
keyup = function() { this.setHeights();
// Value they've entered };
var val = this.value.toLowerCase();
Questions.prototype._handleInput = function (evt) {
var val = evt.target.value.toLowerCase();
// Filter elements based on if their string exists in the product model // Filter elements based on if their string exists in the product model
$questions.each(function( i, el ) { for (var i = 0, len = this.questions.length; i < len; i++) {
var $el = $( el ), var el = this.questions[i];
text = $.trim( $questionTitles.eq( i ).text() ).toLowerCase(), var title = el.querySelector('.question__title').textContent;
passes = text.indexOf( val ) !== -1; var text = title.trim().toLowerCase();
if ( passes ) { if (text.indexOf(val) === -1) {
if ( $el.hasClass( collapsedClass ) ) { el.classList.add('question--collapsed');
$el.removeClass( collapsedClass );
}
} else { } else {
if ( !$el.hasClass( collapsedClass ) ) { el.classList.remove('question--collapsed');
$el.addClass( collapsedClass );
}
} }
}
};
}); Questions.prototype.setHeights = function () {
}, var elements = [].slice.call(this.questions);
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', '' );
// Get new heights elements.forEach(function (element) {
// Inner div needed because setting a height on the elements element.style.height = '';
// self doesn't get the correct new height :\
$questionInners.each(function() {
heights.push( $( this ).css( 'height' ) );
}); });
// Set new heights var heights = elements.map(function (element) {
$questions.each(function( i ) { return element.firstElementChild.offsetHeight;
$( this ).css( 'height', heights[ i ] );
}); });
},
onWindowResize = function() { elements.forEach(function (element, i) {
setHeights(); element.style.height = heights[i] + 'px';
});
}; };
if ( !$searchInput.length ) { Questions.prototype.onWindowResize = function () {
return; this.setHeights();
} };
$searchInput.on( 'keyup change', debouncedKeyup ); new Questions();
$( window ).on( 'resize', $.debounce( 250, onWindowResize ) ); }());
onWindowResize();
}( jQuery ));

@ -1,26 +1,5 @@
'use strict'; '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 = {}; var Modules = {};
Modules.NavTray = (function () { Modules.NavTray = (function () {
@ -269,7 +248,7 @@ document.addEventListener('DOMContentLoaded', function () {
// Only animate the favicon on the homepage so that // Only animate the favicon on the homepage so that
// timeline tests aren't filled with junk // 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'; var src = site_url + '/img/favicon-sprite.png';
new Modules.Favicon(src, 21, 7, 3000 * 1); new Modules.Favicon(src, 21, 7, 3000 * 1);
} }

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

Loading…
Cancel
Save