Closed patrickhuang94 closed 6 years ago
Same issue
Same
Same
I'm seeing similar behavior. It seems like it fixes itself after a browser resize event, but I can't even figure out a hacky way to do this consistently in React.
I have found a solution simply in your CSS in your body tag do something
like this
body {
overflow-x: hidden;
}
I hope it helps anyone having this trouble.
It happens to me when it is server side rendered.
@marhalpert Have you tried the CSS trick I used at my end to resolve this bug.
body {
overflow-x: hidden
}
Mate that worked for when it is not server-side rendered.
Well I hope someone comes up with a solution for this. :)
It's not ideal, but I found forcing the component to update after mounting essentially mimics what happens when the browser window is resized, and leaves it looking as it should.
componentDidMount() { setTimeout(() => { this.forceUpdate(); }, 0); }
@brownsmith thx 4 this solution. Not perfect but still works.
Still having the bug - after some digging I think it calculates the carousel element width and transform wrong - when page with carousel has a scrollbar everything looks fine.
With and without scrollbar the slick-track and carousel elements have the same widths, so without scrollbar image of the next element overlaps with offset equal to scrollbar width. Screens below based on jsfiddle demo of react-slick.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
create an overlay div to block the 1px strip of the next pic
technically speaking: set parent div position relative, create child div width 1px height 100% position aboslute top 0, right 0 background color same as background behind carousel
:)
epenabella, can you provide a demo? Thanks :)
parent is the div the one that you put the carousel in, child is another div as sibling to carousel
CSS:
.parent { position: relative; }
.child {width: 1px; height: 100%, position: absolute; top: 0px, right: 0px; background-color: #
I am using single image and I am targeting active slide. This will scale the active slide and hide extra space.
:global(.slick-active){ scale: 1.1 1; }
I'm using the default example code to put in my images: simply wrapping it inside the Slider component. In the right ~10px margin of the current picture, you can see the next picture - it's sort of leaking into the current picture. However, upon downsizing the browser window and resizing it back to the original full screen, the second picture in the carousel no longer overflows.