question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot scroll to last item if has many items

See original GitHub issue

first, thanks for you library it’s very helpful for my work.

I have some issue when the container has lot of items. ( Ex. 50 items with 150px of width)

I look in the element inspector

this code transform: translate3d(-1805.47%, 0px, 0px)

I guess it’s always back to -1800%

how to increase?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
davidjerlekecommented, May 28, 2020

Hello again @khanitnanj,

Thank you for the CodeSandbox, it helped me debug why you’re experiencing this issue 👍.

Please use padding instead of margin for spacing between slides, like the Basic Setup CodeSandbox on the embla-carousel-react readme shows.

embla

Embla won’t take the slide margins into account when reading the slide widths, which is why you can’t reach the last slide because the margins of 50 slides will stack up. But the padding will be included when reading the slide widths. This of course, assuming that you’re using the box-sizing: border-box; property as default like so:

html {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

Read more about why you would want to use the border-box as default in this article and on this StackOverflow question.

Let me know if this helps!

Cheers David

0reactions
davidjerlekecommented, Mar 24, 2021

Hi again @khanitnanj,

For what it’s worth, Embla Carousel now supports margin and any other means that will render spacing between your slides. You’re not forced to use the padding approach anymore. And it will automatically detect your spacings!

This feature was released with version 4.2.0. Read more about it here if you’re interested.

Kindly, David

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot scroll to last element in content container tailwindcss
I have got the structure almost working but I cannot scroll to the bottom of the content container. I want everything else to...
Read more >
List Box - not able to scroll to last item | MrExcel Message Board
I have a list box that I'm filling dynamically (depends on the file being opened, there could be 1 item and there could...
Read more >
Scroll to Bottom of List in iOS 16… | Apple Developer Forums
I'm trying to add an item to the bottom of a List and then scroll that added item into view. I've made the...
Read more >
Element size and scrolling - The Modern JavaScript Tutorial
Properties scrollLeft/scrollTop are the width/height of the hidden, scrolled out part of the element. On the picture below we can see ...
Read more >
overscroll-behavior - CSS: Cascading Style Sheets | MDN
If you have overscroll-behavior: contain; selected, the outer container will not scroll unless you move your cursor out of the inner container ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found