Skip to content
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

Normalize Scroll Height #64

Closed
axelson opened this issue Apr 10, 2017 · 2 comments
Closed

Normalize Scroll Height #64

axelson opened this issue Apr 10, 2017 · 2 comments

Comments

@axelson
Copy link

axelson commented Apr 10, 2017

Is it possible for each slide to have it's own height? Right now the shorter slides have giant blank spaces below them since all the slides are the same height as the longest slide.

Related swipe.js issue: thebird/Swipe#116

@loup-brun
Copy link
Collaborator

loup-brun commented Apr 10, 2017

Hi @axelson,

What you want to achieve may be accompllshed with CSS.

In fact, the Swipe container takes up as much height as the biggest slide; the smaller slides do not cover up all the Swipe container.

The way to accomplish a more aesthetic result is by normalizing the slides' heights altogether. There are several ways to achieve this:

  • If the height of each div is predictable and can be pre-determined, you may assign a fixed height to each swipe-wrap > div (e.g. height: 260px).
  • If the height of each div is fluid or unpredictable, you could use flexbox by simply adding display: flex to the .swipe-wrap container. By default, the browser will make all children stretch the height of their container (specified by the align-items: stretch rule).

I set up a little jsbin demo for you to view the solution in effect. Here's a screenshot:

capture du 2017-04-09 22-54-40

Please let me know if this suits your needs. If so, you may close this issue.

@loup-brun
Copy link
Collaborator

I'll close this since it is actually a matter of dealing with the CSS. Let me know if you need help achieving what you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants