Add FAQ page.
parent
c6443d57e8
commit
e381e16b0f
@ -0,0 +1,64 @@
|
||||
---
|
||||
layout: default
|
||||
title: Shuffle.js FAQ
|
||||
description: Frequently asked questions about Shuffle.js
|
||||
image: /hero.png
|
||||
extraJS: [ "faq.js" ]
|
||||
---
|
||||
<section class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<h2>FAQs</h2>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<section class="container-fluid search-section">
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<input type="search" placeholder="Search..." class="faq-search" id="search" />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<section class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="question js-question">
|
||||
<div class="question__inner">
|
||||
<h3 class="question__text">Why Does Shuffle leave empty spaces?</h3>
|
||||
<p class="question__answer">The algorithm used to place items does not keep track of empty space nor try to fill them. If you require this functionality, I suggest <a target="_blank" href="http://packery.metafizzy.co/">packery</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="question js-question">
|
||||
<div class="question__inner">
|
||||
<h3 class="question__text">Why are images overlapping?</h3>
|
||||
<p class="question__answer">If the size of your items are dependent on images, they can overlap if shuffle is initialized before all the images have loaded. Check out <a href="{{ site.url }}/{% post_url demos/2013-05-03-images %}">this demo</a> to see how to fix it.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% comment %}
|
||||
<div class="question js-question">
|
||||
<div class="question__inner">
|
||||
<h3 class="question__text">Hi</h3>
|
||||
<p class="question__answer">Check yo' self</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endcomment %}
|
||||
|
||||
<div class="question question--unanswered">
|
||||
<div class="question__inner">
|
||||
<h3 class="question__text">Didn't find an answer?</h3>
|
||||
<p class="question__answer">Try looking at the javascript files for the demos or searching the issues <a href="https://github.com/Vestride/Shuffle/issues">on GitHub</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<section class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
</div>
|
||||
</section>
|
||||
|
@ -0,0 +1,69 @@
|
||||
|
||||
// Requires jQuery and jQuery.debounce
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
var collapsedClass = 'collapsed',
|
||||
$searchInput = $('#search'),
|
||||
$questions = $('.js-question'),
|
||||
$questionInners = $questions.find('.question__inner'),
|
||||
$questionTexts = $questions.find('.question__text'),
|
||||
|
||||
keyup = function() {
|
||||
// Value they've entered
|
||||
var val = this.value.toLowerCase();
|
||||
|
||||
// Filter elements based on if their string exists in the product model
|
||||
$questions.each(function( i, el ) {
|
||||
var $el = $( el ),
|
||||
text = $.trim( $questionTexts.eq( i ).text() ).toLowerCase(),
|
||||
passes = text.indexOf( val ) !== -1;
|
||||
|
||||
if ( passes ) {
|
||||
if ( $el.hasClass( collapsedClass ) ) {
|
||||
$el.removeClass( collapsedClass );
|
||||
}
|
||||
} else {
|
||||
if ( !$el.hasClass( collapsedClass ) ) {
|
||||
$el.addClass( collapsedClass );
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
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
|
||||
// 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' ) );
|
||||
});
|
||||
|
||||
// Set new heights
|
||||
$questions.each(function( i ) {
|
||||
$( this ).css( 'height', heights[ i ] );
|
||||
});
|
||||
},
|
||||
|
||||
onWindowResize = function() {
|
||||
setHeights();
|
||||
};
|
||||
|
||||
if ( !$searchInput.length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$searchInput.on( 'keyup change', debouncedKeyup );
|
||||
$( window ).on( 'resize', $.debounce( 250, onWindowResize ) );
|
||||
onWindowResize();
|
||||
|
||||
}( jQuery ));
|
Loading…
Reference in New Issue