flickity icon indicating copy to clipboard operation
flickity copied to clipboard

Slide wider than viewport

Open coreyworrell opened this issue 8 years ago β€’ 9 comments

Test case: http://codepen.io/coreyworrell/pen/PNKyrQ

This mostly applies to when you have the freeScroll setting on.

You'll see there how if you have a slide that is wider than the viewport, you have to "overscroll" to see the hidden part of the slide (overscroll left for the first slide, or right for the last slide). Setting the cellAlign option will allow you to see the entire slide, but only the first or last (depending on if you set it as left or right).

Is it possible to allow user to scroll from the left edge of the first slide to the right edge of the last slide?

Thank you.

coreyworrell avatar Mar 30 '16 22:03 coreyworrell

Thank you for reporting this bug and including a test case! Yup, this is indeed a bug. But I'm not sure how often other users are going to run into it.

+1 or add :+1: reaction if you'd like to see this bug fixed.

desandro avatar Apr 01 '16 00:04 desandro

I'm also having this issue. Has anyone figured out a solution?

My use case is multiple slides with 3 columns inside each slide, which is making the slide wider than the carousel viewport. πŸ‘Ž

jshrssll avatar Jan 10 '17 05:01 jshrssll

Why do we need to πŸ‘or +1 for you to fix a bug?

Nathanw avatar May 16 '18 12:05 Nathanw

@Nathanw Because I need to way to prioritize issues. 'Fixing bugs' sometimes adding complexity to the codebase which makes it harder to maintain.

desandro avatar May 16 '18 15:05 desandro

same here

rsepierre avatar Dec 14 '18 06:12 rsepierre

would be nice to get this bug fixed :)

flmuel avatar Feb 20 '19 21:02 flmuel

+1 thanks

xxvii avatar Feb 22 '19 17:02 xxvii

+1

TaraOShea avatar Aug 26 '19 17:08 TaraOShea

If anyone is interested in a hack to fix this. I fixed it with overriding _containSlides with this: ` Flickity.prototype._containSlides = function() { if ( !this.options.contain || this.options.wrapAround || !this.cells.length ) { return; } var isRightToLeft = this.options.rightToLeft; var beginMargin = isRightToLeft ? 'marginRight' : 'marginLeft'; var endMargin = isRightToLeft ? 'marginLeft' : 'marginRight'; var contentWidth = this.slideableWidth - this.getLastCell().size[ endMargin ];

	// content is less than gallery size
	var isContentSmaller = contentWidth < this.size.innerWidth;

	// bounds
	var beginBound = this.cursorPosition + this.cells[0].size[ beginMargin ];
	var endBound = contentWidth - this.size.innerWidth * ( 1 - this.cellAlign );
	// contain each cell target

	var slideI = 1;
	this.slides.forEach( function( slide ) {
	  if ( isContentSmaller ) {
		// all cells fit inside gallery
		slide.target = contentWidth * this.cellAlign;
	  } else {
		// contain to bounds
		slide.target = Math.max( slide.target, beginBound );
		slide.target = Math.min( slide.target, endBound );

		if (slideI == this.slides.length && this.options.freeScroll) {
			slide.target = Math.max( slide.target, endBound );
		}
	  }
	  slideI++;
	}, this );
};

`

Tim-Wils avatar Jul 14 '21 10:07 Tim-Wils