Remove padding offset fixes. Add info about it to FAQ.

pull/56/head
Glen Cheney 10 years ago
parent f2367d24e2
commit 5b51302b27

@ -26,21 +26,21 @@ extraJS: [ "faq.js" ]
<article id="spaces" class="question js-question">
<div class="question__inner">
<h3 class="question__text">Why Does Shuffle leave empty spaces?</h3>
<h3 class="question__title">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>
</article>
<article id="images" class="question js-question">
<div class="question__inner">
<h3 class="question__text">Why are images overlapping?</h3>
<h3 class="question__title">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.baseurl }}{% post_url demos/2013-05-03-images %}">this demo</a> to see how to fix it.</p>
</div>
</article>
<article id="isotope" class="question js-question">
<div class="question__inner">
<h3 class="question__text">What&rsquo;s the difference between Shuffle and Isotope?</h3>
<h3 class="question__title">What&rsquo;s the difference between Shuffle and Isotope?</h3>
<div class="question__answer">
<span>Isotope:</span>
<ul>
@ -58,23 +58,37 @@ extraJS: [ "faq.js" ]
<li>sizer element (which <a href="http://packery.metafizzy.co/options.html#element-sizing">packery also has</a>)</li>
</ul>
<p>They are <em>very</em> similar, but I think Shuffle's filtering and sorting are easier to customize, which is the main reason I created this plugin. Isotope does have a much larger community, more tests, and more stackoverflow answers though.</p>
<p>They are <em>very</em> similar, but I think Shuffle's filtering and sorting are easier to customize, which is the main reason I created this plugin. Isotope has a much larger community, is battle-tested, and has many stackoverflow answers.</p>
</div>
</div>
</article>
<article id="zepto" class="question js-question">
<div class="question__inner">
<h3 class="question__text">Does Shuffle work with Zepto?</h3>
<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>
<p class="question__answer">The padding is ignored by Shuffle because it creates complexities with absolute positioning the shuffle-items when they have a percentage width as well as setting the height of the shuffle container because of box-sizing. To fix this, wrap the shuffle element in another element which has the padding on it.</p>
</div>
</article>
<article id="centering" class="question js-question">
<div class="question__inner">
<h3 class="question__title">Can the columns be centered?</h3>
<p class="question__answer">Nope. Shuffle is heavily based on columns for layout. You can add &ldquo;empty&rdquo; items to achieve a similar effect.</p>
</div>
</article>
{% comment %}
<article class="question js-question">
<div class="question__inner">
<h3 class="question__text">Hi</h3>
<h3 class="question__title">Hi</h3>
<p class="question__answer">Check yo' self</p>
</div>
</article>
@ -82,7 +96,7 @@ extraJS: [ "faq.js" ]
<article class="question question--unanswered">
<div class="question__inner">
<h3 class="question__text">Didn't find an answer?</h3>
<h3 class="question__title">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>
</article>

@ -255,7 +255,7 @@ input.faq-search {
border-top: 2px solid $emerald;
}
.question__text {
.question__title {
margin-top: 0;
}

@ -1602,7 +1602,7 @@ input.faq-search:focus::-moz-input-placeholder {
padding-top: 1.25em;
border-top: 2px solid #2ECC71; }
.question__text {
.question__title {
margin-top: 0; }
.question__answer {

@ -242,7 +242,6 @@ Shuffle.settings = {
left: 0,
visibility: 'visible'
},
offset: { top: 0, left: 0 },
revealAppendedDelay: 300,
lastSort: {},
lastFilter: ALL_ITEMS,
@ -399,7 +398,7 @@ Shuffle.prototype._init = function() {
this.useSizer = true;
}
// Add classes and invalidate styles
// Add class and invalidate styles
this.$el.addClass( Shuffle.ClassName.BASE );
// Set initial css for each item
@ -410,21 +409,15 @@ Shuffle.prototype._init = function() {
$window.on('resize.' + SHUFFLE + '.' + this.unique, this._getResizeFunction());
// Get container css all in one request. Causes reflow
var containerCSS = this.$el.css(['paddingLeft', 'paddingRight', 'position', 'overflow']);
var containerCSS = this.$el.css(['position', 'overflow']);
var containerWidth = Shuffle._getOuterWidth( this.element );
// Add styles to the container if it doesn't have them.
this._validateStyles(containerCSS);
// Get offset from container
this.offset = {
left: Shuffle._getInt( containerCSS.paddingLeft ),
top: Shuffle._getInt( containerCSS.paddingTop )
};
this._validateStyles( containerCSS );
// We already got the container's width above, no need to cause another reflow getting it again...
// Calculate the number of columns there will be
this._setColumns( parseInt( containerWidth, 10 ) );
this._setColumns( containerWidth );
// Kick off!
this.shuffle( this.group, this.initialSort );
@ -884,8 +877,8 @@ Shuffle.prototype._getItemPosition = function( itemSize ) {
// Position the item
var point = new Point(
Math.round( (this.colWidth * shortColumnIndex) + this.offset.left ),
Math.round( setY[shortColumnIndex] + this.offset.top ));
Math.round( this.colWidth * shortColumnIndex ),
Math.round( setY[shortColumnIndex] ));
// Update the columns array with the new values for each column.
// e.g. before the update the columns could be [250, 0, 0, 0] for an item

@ -248,7 +248,6 @@ Shuffle.settings = {
left: 0,
visibility: 'visible'
},
offset: { top: 0, left: 0 },
revealAppendedDelay: 300,
lastSort: {},
lastFilter: ALL_ITEMS,
@ -405,7 +404,7 @@ Shuffle.prototype._init = function() {
this.useSizer = true;
}
// Add classes and invalidate styles
// Add class and invalidate styles
this.$el.addClass( Shuffle.ClassName.BASE );
// Set initial css for each item
@ -416,21 +415,15 @@ Shuffle.prototype._init = function() {
$window.on('resize.' + SHUFFLE + '.' + this.unique, this._getResizeFunction());
// Get container css all in one request. Causes reflow
var containerCSS = this.$el.css(['paddingLeft', 'paddingRight', 'position', 'overflow']);
var containerCSS = this.$el.css(['position', 'overflow']);
var containerWidth = Shuffle._getOuterWidth( this.element );
// Add styles to the container if it doesn't have them.
this._validateStyles(containerCSS);
// Get offset from container
this.offset = {
left: Shuffle._getInt( containerCSS.paddingLeft ),
top: Shuffle._getInt( containerCSS.paddingTop )
};
this._validateStyles( containerCSS );
// We already got the container's width above, no need to cause another reflow getting it again...
// Calculate the number of columns there will be
this._setColumns( parseInt( containerWidth, 10 ) );
this._setColumns( containerWidth );
// Kick off!
this.shuffle( this.group, this.initialSort );
@ -890,8 +883,8 @@ Shuffle.prototype._getItemPosition = function( itemSize ) {
// Position the item
var point = new Point(
Math.round( (this.colWidth * shortColumnIndex) + this.offset.left ),
Math.round( setY[shortColumnIndex] + this.offset.top ));
Math.round( this.colWidth * shortColumnIndex ),
Math.round( setY[shortColumnIndex] ));
// Update the columns array with the new values for each column.
// e.g. before the update the columns could be [250, 0, 0, 0] for an item

@ -7,7 +7,7 @@
$searchInput = $('#search'),
$questions = $('.js-question'),
$questionInners = $questions.find('.question__inner'),
$questionTexts = $questions.find('.question__text'),
$questionTitles = $questions.find('.question__title'),
keyup = function() {
// Value they've entered
@ -16,7 +16,7 @@
// 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(),
text = $.trim( $questionTitles.eq( i ).text() ).toLowerCase(),
passes = text.indexOf( val ) !== -1;
if ( passes ) {

@ -225,7 +225,6 @@ Shuffle.settings = {
left: 0,
visibility: 'visible'
},
offset: { top: 0, left: 0 },
revealAppendedDelay: 300,
lastSort: {},
lastFilter: ALL_ITEMS,
@ -382,7 +381,7 @@ Shuffle.prototype._init = function() {
this.useSizer = true;
}
// Add classes and invalidate styles
// Add class and invalidate styles
this.$el.addClass( Shuffle.ClassName.BASE );
// Set initial css for each item
@ -393,21 +392,15 @@ Shuffle.prototype._init = function() {
$window.on('resize.' + SHUFFLE + '.' + this.unique, this._getResizeFunction());
// Get container css all in one request. Causes reflow
var containerCSS = this.$el.css(['paddingLeft', 'paddingRight', 'position', 'overflow']);
var containerCSS = this.$el.css(['position', 'overflow']);
var containerWidth = Shuffle._getOuterWidth( this.element );
// Add styles to the container if it doesn't have them.
this._validateStyles(containerCSS);
// Get offset from container
this.offset = {
left: Shuffle._getInt( containerCSS.paddingLeft ),
top: Shuffle._getInt( containerCSS.paddingTop )
};
this._validateStyles( containerCSS );
// We already got the container's width above, no need to cause another reflow getting it again...
// Calculate the number of columns there will be
this._setColumns( parseInt( containerWidth, 10 ) );
this._setColumns( containerWidth );
// Kick off!
this.shuffle( this.group, this.initialSort );
@ -867,8 +860,8 @@ Shuffle.prototype._getItemPosition = function( itemSize ) {
// Position the item
var point = new Point(
Math.round( (this.colWidth * shortColumnIndex) + this.offset.left ),
Math.round( setY[shortColumnIndex] + this.offset.top ));
Math.round( this.colWidth * shortColumnIndex ),
Math.round( setY[shortColumnIndex] ));
// Update the columns array with the new values for each column.
// e.g. before the update the columns could be [250, 0, 0, 0] for an item

Loading…
Cancel
Save