Docs update/fixes

pull/56/head
Glen Cheney 10 years ago
parent 0842133655
commit 5a7f9f3784

@ -1,6 +1,6 @@
<h2>Events<a href="#events"></a></h2>
<p>A list of events shuffle triggers:</p>
<ul>
<ul class="breathable-list">
<li><code class="language-javascript">'loading.shuffle'</code></li>
<li><code class="language-javascript">'done.shuffle'</code></li>
<li><code class="language-javascript">'shrink.shuffle'</code></li>
@ -10,9 +10,9 @@
<li><code class="language-javascript">'layout.shuffle'</code></li>
<li><code class="language-javascript">'removed.shuffle'</code></li>
</ul>
<p><strong>Heads up!</strong> To receive the <code>loading</code> event, you must subscribe to it before initializing the plugin, otherwise it will fire before you have subscribed to it.</p>
<h3>Get notified when shuffle is done with setup</h3>
<p>To receive the <code>loading</code> and <code>done</code> events, you must subscribe to them before initializing the plugin, otherwise they will fire before you have subscribed to them</p>
<pre rel="JavaScript"><code class="language-javascript">$grid.on('done.shuffle', function() {
console.log('Finished initializing shuffle!');
});

@ -38,13 +38,13 @@
&lt;/figure&gt;
&lt;/div&gt;</code></pre>
<h3 id="columns">How column widths work</h3>
<h3 id="columns">How column widths work<a href="#how-column-widths-work"></a></h3>
<p>The <code>columnWidth</code> option is used to calculate the column width. You have several options:</p>
<ol>
<li>Use a <strong>sizer</strong> element. This is the easest way to specify column and gutter widths. You can use an element or an element wrapped in jQuery. The column and gutter widths will be measured using this element. The <code>sizer</code> option is an alias for <code>columnWidth</code>.<span class="demo-link-container">See <a href="{{ site.baseurl }}{% post_url demos/2013-05-01-basic %}">a demo</a> using a sizer element or <a href="{{ site.baseurl }}/js/demos/homepage.js">look at the js file</a> for the sizer demo.</span></li>
<li>Use a <strong>sizer</strong> element. This is the easest way to specify column and gutter widths. You can use an element or an element wrapped in jQuery to define the column width and gutter width. Shuffle will measure the <code>width</code> and <code>margin-left</code> of this <code>sizer</code> element each time the grid resizes. This is awesome for responsive or fluid grids where the width of a column is a percentage. The <code>sizer</code> option is an alias for <code>columnWidth</code>.<span class="demo-link-container">See <a href="{{ site.baseurl }}{% post_url demos/2013-05-01-basic %}">a demo</a> using a sizer element or <a href="{{ site.baseurl }}/js/demos/homepage.js">look at the js file</a> for the sizer demo.</span></li>
<li>Use a <strong>function</strong>. When a function is used, its first parameter will be the width of the shuffle element. You need to return the column width for shuffle to use (in pixels).</li>
<li>A <strong>number</strong>. This will explicitly set the column width to your number (in pixels).</li>
<li>By default, shuffle will use jQuery's <code class="language-javascript">outerWidth(true)</code> to calculate the column width of the first item and use that value.</li>
<li>By default, shuffle will use the width of the first item to calculate the column width.</li>
</ol>
<h3>A basic setup example</h3>

@ -32,6 +32,14 @@ ul ul {
list-style-type: circle;
}
li {
line-height: 1.4;
}
.breathable-list li {
line-height: 1.7;
}
.site-nav {

@ -1,6 +1,5 @@
@import "variables";
$sqrt3: 1.73205080757;
.filter-options {
margin-top: 20px;
@ -86,15 +85,20 @@ $sqrt3: 1.73205080757;
}
$triangleSize: 220px;
$halfSize: $triangleSize / 2;
$fullSideWidth: round($sqrt3 * $halfSize);
$leftOver: $triangleSize - $fullSideWidth;
.shape--triangle .shape__space {
@mixin equilateralTriangle($size) {
$sqrt3: 1.73205080757;
$halfSize: $size / 2;
$fullSideWidth: round($sqrt3 * $halfSize);
$leftOver: $size - $fullSideWidth;
padding-top: $leftOver / 2;
height: 0;
width: 0;
border-width: 0 $halfSize $fullSideWidth $halfSize;
}
.shape--triangle .shape__space {
@include equilateralTriangle(220px);
background-color: transparent;
}
@ -118,53 +122,37 @@ $leftOver: $triangleSize - $fullSideWidth;
@media (min-width: 1200px) {
$triangleSize: 270px;
$halfSize: $triangleSize / 2;
$fullSideWidth: round($sqrt3 * $halfSize);
$leftOver: $triangleSize - $fullSideWidth;
.shape--triangle .shape__space {
padding-top: $leftOver / 2;
border-width: 0 $halfSize $fullSideWidth $halfSize;
@include equilateralTriangle(270px);
}
}
@media (min-width: 768px) and (max-width: 979px) {
$triangleSize: 166px;
$halfSize: $triangleSize / 2;
$fullSideWidth: round($sqrt3 * $halfSize);
$leftOver: $triangleSize - $fullSideWidth;
.shape--triangle .shape__space {
padding-top: $leftOver / 2;
border-width: 0 $halfSize $fullSideWidth $halfSize;
@include equilateralTriangle(166px);
}
}
@media (max-width: 767px) {
$triangleSize: 200px;
$halfSize: $triangleSize / 2;
$fullSideWidth: round($sqrt3 * $halfSize);
$leftOver: $triangleSize - $fullSideWidth;
.shape--triangle .shape__space {
@include equilateralTriangle(600px);
margin: auto;
}
}
@media (max-width: 600px) {
.shape--triangle .shape__space {
padding-top: $leftOver / 2;
border-width: 0 $halfSize $fullSideWidth $halfSize;
@include equilateralTriangle(480px);
}
}
@media (max-width: 480px) {
$triangleSize: 100px;
$halfSize: $triangleSize / 2;
$fullSideWidth: round($sqrt3 * $halfSize);
$leftOver: $triangleSize - $fullSideWidth;
.shape--triangle .shape__space {
padding-top: $leftOver / 2;
border-width: 0 $halfSize $fullSideWidth $halfSize;
@include equilateralTriangle(320px);
}
}

@ -95,25 +95,42 @@
@media (min-width: 1200px) {
.shape--triangle .shape__space {
padding-top: 18px;
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: 13.5px;
border-width: 0 100px 173px 100px;
padding-top: 40px;
height: 0;
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: 6.5px;
border-width: 0 50px 87px 50px;
padding-top: 21.5px;
height: 0;
width: 0;
border-width: 0 160px 277px 160px;
}
}
body::before {

@ -1945,6 +1945,14 @@ ul ul {
list-style-type: circle;
}
li {
line-height: 1.4;
}
.breathable-list li {
line-height: 1.7;
}
.site-nav .site-nav__title {
color: #ecf0f1;
}

@ -16,9 +16,7 @@ var DEMO = (function( $ ) {
setupSearching();
}, 100);
// You can subscribe to custom events. To receive the loading and done events,
// you must subscribe to them before initializing the plugin, otherwise they will
// fire before you have subscribed to them
// You can subscribe to custom events.
// shrink, shrunk, filter, filtered, sorted, load, done
$grid.on('loading.shuffle done.shuffle shrink.shuffle shrunk.shuffle filter.shuffle filtered.shuffle sorted.shuffle layout.shuffle', function(evt, shuffle) {
// Make sure the browser has a console

Loading…
Cancel
Save