Adding nav and webp screenshots for demos

pull/56/head
Glen Cheney 11 years ago
parent 3aa94d53f9
commit 7a962634d0

@ -7,6 +7,24 @@ exclude: ['./_scss/*.*']
permalink: /:title
demos:
- url: 'demos/2013-05-01-basic'
slug: basic
label: Basic masonry layout
screenshot: basic.webp
- url: 'demos/2013-06-19-adding-removing'
slug: adding-removing
label: Adding and removing items
screenshot: removing.webp
- url: 'demos/2013-05-02-adaptive'
slug: adaptive
label: Twitter bootstrap adaptive masonry with compounded filters
screenshot: adaptive.webp
- url: 'demos/2013-05-03-responsive'
slug: responsive
label: Responsive?
screenshot: responsive.webp
items:
- groups: [ photography ]
date: 2010-09-14

@ -0,0 +1,26 @@
<nav class="site-nav collapsed" id="nav" role="primary">
<div class="js-tray site-nav__tray">
<div class="container-fluid">
<div class="row-fluid">
{% for post in site.demos %}
<div class="span3 figure-wrap">
<a href="/{{ post.slug }}">
<figure>
<div class="keep-ratio four-three">
<img src="{{ site.url }}/img/demos/{{ post.slug }}.webp" alt="{{ post.label }}" />
</div>
<figcaption>{{ post.label }}</figcaption>
</figure>
</a>
</div>
{% endfor %}
</div>
</div>
</div>
<div class="site-nav__band">
<div class="container-fluid">
<button class="js-nav-toggle pull-right" data-close-label="Close Nav">Open Nav</button>
</div>
</div>
</nav>

@ -4,9 +4,16 @@
<!--[if gte IE 9]><!-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<!--<![endif]-->
<!-- Shuffle! -->
<script src="{{ site.url }}/js/jquery.shuffle.js"></script>
<!-- Syntax highlighting via Prism -->
<script src="{{ site.url }}/js/prism.js"></script>
<!-- Make the nav work -->
<script src="{{ site.url }}/js/page.js"></script>
{% if page.extraJS && page.extraJS.length %}
{% for src in page.extraJS %}
<script src="{{ site.url }}/js/demos/{{ src }}"></script>

@ -1,4 +1,5 @@
{% include head.html %}
{% include nav.html %}
{% if page.includeHeader %}
<header class="container-fluid">
<div class="row-fluid">

@ -1,6 +1,6 @@
---
layout: default
title: Shuffle Responsive Demo
title: Shuffle Adaptive Demo
bodyClass: masonry
extraJS: [ "gallery.js" ]
extraCSS: [ "http://twitter.github.io/bootstrap/assets/css/bootstrap.css", "http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css", "/css/gallery.css" ]

@ -1,7 +1,14 @@
@import "variables";
pre {
max-height: 30em;
}
img {
max-width: 100%;
height: auto;
}
/* lets have some constraints shall we */
.container-fluid {
width: 93%;
@ -21,6 +28,25 @@ ul ul {
}
.site-nav {
.site-nav__tray {
transition: .2s;
overflow: hidden;
height: 300px;
background-color: $wetAsphalt;
}
&.collapsed .site-nav__tray {
height: 0;
}
.figure-wrap:nth-child(4n + 1) {
margin-left: 0;
}
}
nav > a {
display: block;
margin: 5px 0;
@ -42,6 +68,19 @@ nav > a {
}
.keep-ratio {
position: relative;
width: 100%;
height: 0;
overflow: hidden;
padding-bottom: 100%;
&.four-three {
padding-bottom: 75%;
}
}

@ -1513,6 +1513,10 @@ h4 {
pre {
max-height: 30em; }
img {
max-width: 100%;
height: auto; }
/* lets have some constraints shall we */
.container-fluid {
width: 93%;
@ -1528,6 +1532,16 @@ ul ul {
margin: 0;
list-style-type: circle; }
.site-nav .site-nav__tray {
transition: .2s;
overflow: hidden;
height: 300px;
background-color: #34495e; }
.site-nav.collapsed .site-nav__tray {
height: 0; }
.site-nav .figure-wrap:nth-child(4n + 1) {
margin-left: 0; }
nav > a {
display: block;
margin: 5px 0; }
@ -1541,6 +1555,15 @@ nav > a {
.sort-options {
margin-top: 10px; }
.keep-ratio {
position: relative;
width: 100%;
height: 0;
overflow: hidden;
padding-bottom: 100%; }
.keep-ratio.four-three {
padding-bottom: 75%; }
.btn-group:before, .btn-group:after {
content: " ";
display: table; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

@ -63,12 +63,8 @@ includeHeader: true
<section id="demos">
<div class="container-fluid">
<h2>Other Examples</h2>
<nav role="primary">
<a href="{% post_url demos/2013-05-01-basic %}">Basic masonry layout</a>
<a href="{% post_url demos/2013-05-03-minimal %}">The minimal markup with filters</a>
<a href="{% post_url demos/2013-05-02-adaptive %}">Twitter bootstrap adaptive masonry with compounded filters</a>
</nav>
<h2>Demos</h2>
<a href="#nav">In the nav</a>
</div>
</section>

@ -390,7 +390,7 @@ Shuffle.prototype = {
if ( window.getComputedStyle ) {
dimension = window.getComputedStyle( element, null )[ style ];
} else {
dimension = $( element ).css( dimension );
dimension = $( element ).css( style );
}
return parseFloat( dimension );
},

@ -0,0 +1,173 @@
/**
* @author Glen Cheney
* Debounce plugin is included in shuffle
*/
var Support = (function() {
'use strict';
var self = {},
// some small (2x1 px) test images for each feature
webpImages = {
basic: 'data:image/webp;base64,UklGRjIAAABXRUJQVlA4ICYAAACyAgCdASoCAAEALmk0mk0iIiIiIgBoSygABc6zbAAA/v56QAAAAA==',
lossless: 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA='
};
self.webp = function( feature ) {
var dfd = $.Deferred();
$('<img>')
.on('load', function() {
// the images should have these dimensions
if ( this.width === 2 && this.height === 1 ) {
dfd.resolve();
} else {
dfd.reject();
}
})
// Reject deferred on error
.on('error', function() {
dfd.reject();
})
// Set the image src
.attr('src', webpImages[ feature || 'basic' ]);
return dfd.promise();
};
return self;
}());
var Polyfill = (function( $, Support ) {
'use strict';
var init = function() {
// If the deferred object in webp is rejected, call the webp polyfill function
Support.webp().fail( webp );
},
webp = function() {
$('img[src$=".webp"]').each(function() {
this.src = this.src.replace('.webp', '.jpg');
});
};
return {
init: init
};
}( jQuery, Support ));
var NAV = (function( $ ) {
'use strict';
function NavTray( element ) {
this.$el = $( element );
this.init();
}
NavTray.prototype.init = function() {
this
.setVars()
.listen();
setTimeout( $.proxy( this.saveHeight, this ), 0);
};
NavTray.prototype.setVars = function() {
var self = this;
self.isOpen = false;
self.$window = $( window );
self.$trigger = self.$el.find('.js-nav-toggle');
self.$tray = self.$el.find('.js-tray');
self.$trigger.data( 'openLabel', self.$trigger.text() );
return self;
};
NavTray.prototype.saveHeight = function() {
var self = this,
height = self.$tray.children().first().outerHeight();
self.collapseHeight = height;
return height;
};
NavTray.prototype.listen = function() {
var self = this;
self.$trigger.on( 'click', $.proxy( self.toggle, self ) );
self.$window.on( 'resize', $.debounce( 250, $.proxy( self.onResize, self ) ) );
return self;
};
NavTray.prototype.onResize = function() {
var self = this;
self.saveHeight();
};
NavTray.prototype.toggle = function() {
var self = this;
self.toggleBtnText();
if ( self.isOpen ) {
self.close();
} else {
self.open();
}
return self;
};
NavTray.prototype.open = function() {
var self = this;
self.$el.removeClass('collapsed');
self.$tray.css( 'height', self.collapseHeight );
self.isOpen = true;
};
NavTray.prototype.close = function() {
var self = this;
self.$el.addClass('collapsed');
self.$tray.css( 'height', '' );
self.isOpen = false;
};
NavTray.prototype.toggleBtnText = function() {
var self = this,
key= self.isOpen ? 'openLabel' : 'closeLabel';
self.$trigger.text( self.$trigger.data( key ) );
return self;
};
return {
init: function() {
return new NavTray( document.getElementById('nav') );
}
};
}( jQuery ));
$(document).ready(function() {
NAV.init();
Polyfill.init();
});
Loading…
Cancel
Save