New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flickity breaks cells with variable widths #324
Comments
shift slider according to cellAlign on cellChange Fixes bug with imagesLoaded and freeScroll not aligning cells properly Ref #324
Thanks for reporting this bug! The the layout bug is caused by using A better solution is to use flex-box for the gallery-cell layout. See demo on CodePen. Now there's one last bug, using // fix freeScroll and imagesLoaded alignment bug
Flickity.prototype.cellChange = function( changedCellIndex, isPositioningSlider ) {
var prevSlideableWidth = this.slideableWidth;
this._positionCells( changedCellIndex );
this._getWrapShiftCells();
this.setGallerySize();
// position slider
if ( this.options.freeScroll ) {
// shift x by change in slideableWidth
// TODO fix position shifts when prepending w/ freeScroll
var delta = prevSlideableWidth - this.slideableWidth;
this.x += delta * this.cellAlign;
this.positionSlider();
} else {
// do not position slider after lazy load
if ( isPositioningSlider ) {
this.positionSliderAtSelected();
}
this.select( this.selectedIndex );
}
}; |
Thank you so much, David! 💙 I've made a working demo with tables in place of flex box (which I can't use in my project yet) Upd: CSS tables work as well. |
This bug has been fixed in Flickity v1.2.0. Get the latest version at http://flickity.metafizzy.co . Thanks so much for your input here. Glad to have this one solved 🐻 |
I'm very sorry for posting an implementation question but I'm desperate :(
Reduced test case:
http://codepen.io/EugeneDae/pen/wMRKJK
Here's how it should look like: (I've replaced Flickity's function with
overflow: scroll
):http://codepen.io/EugeneDae/pen/qbLbBz
Each cell consists of an image of arbitrary width followed by a caption, which is a
<div>
with text on orange background.I'd appreciate any thoughts.
Same question on StackOverflow. Thanks in advanceThe text was updated successfully, but these errors were encountered: