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

fix(demo): direct link to specific carousel sample not working #3272

Merged
merged 1 commit into from
Jul 10, 2019

Conversation

divdavem
Copy link
Member

@divdavem divdavem commented Jul 3, 2019

The carousel samples in the demo site contain images that are loaded asynchronously. But as their size is not reserved beforehand, they shift the remaining content when loaded. As a consequence, the scrolling position that was set correctly to target a specific sample before the images are loaded is no longer correct after the images are loaded.

This PR reserves the space for the images by using the trick documented in the following link to also keep the responsive behavior:
https://itnext.io/how-to-stop-content-jumping-when-images-load-7c915e47f576

Before submitting a pull request, please make sure you have at least performed the following:

  • read and followed the CONTRIBUTING.md guide.
  • built and tested the changes locally.
  • added/updated any applicable tests.
  • added/updated any applicable API documentation.
  • added/updated any applicable demos.

@codecov-io
Copy link

Codecov Report

Merging #3272 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3272   +/-   ##
=======================================
  Coverage   90.77%   90.77%           
=======================================
  Files          95       95           
  Lines        2711     2711           
  Branches      507      507           
=======================================
  Hits         2461     2461           
  Misses        190      190           
  Partials       60       60
Flag Coverage Δ
#e2e 55.21% <ø> (ø) ⬆️
#unit 87.89% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b2b5361...74c9c69. Read the comment docs.

Copy link
Member

@fbasso fbasso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @divdavem. LGTM !

@divdavem
Copy link
Member Author

divdavem commented Jul 3, 2019

@fbasso Thank you for your review!

@benouat benouat added this to the 5.1.0 milestone Jul 4, 2019
Copy link
Member

@benouat benouat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

Nonetheless, I left a little remark that we should address I think.

@@ -41,3 +41,17 @@ ngbd-table-filtering span.ngb-highlight {
ngbd-table-complete span.ngb-highlight {
background-color: yellow;
}

.picsum-img-wrapper {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nitpicking here, but I would actually have prefixed that selector with ngb-caroussel so that we know it's used inside caroussel demos just by reading here.

ngb-caroussel .picsum-img-wrapper {
}

padding-top: 55%; /* Keep ratio for 900x500 images */
}

.picsum-img-wrapper>img {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some remark as above.

The carousel samples in the demo site contain images that are loaded
asynchronously. But as their size is not reserved beforehand, they shift
the remaining content when loaded. As a consequence, the scrolling position
that was set correctly to target a specific sample before the images are
loaded is no longer correct after the images are loaded.

This commit reserves the space for the images by using the trick documented
in the following link to also keep the responsive behavior:
https://itnext.io/how-to-stop-content-jumping-when-images-load-7c915e47f576
@divdavem divdavem force-pushed the carouselDemoReserveImageSize branch from 74c9c69 to 0b69f1c Compare July 4, 2019 10:07
@divdavem
Copy link
Member Author

divdavem commented Jul 4, 2019

@benouat Thank you for your review! I have prefixed the two css rules with ngb-carousel as you suggested.

Copy link
Member

@benouat benouat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@benouat benouat merged commit a6d73d6 into ng-bootstrap:master Jul 10, 2019
@divdavem
Copy link
Member Author

@benouat Thank you for merging my PR!

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

Successfully merging this pull request may close these issues.

None yet

4 participants