ganlanyuan / tiny-slider

Vanilla javascript slider for all purposes.
MIT License
5.26k stars 786 forks source link

Carousel cuts off part of the last element of the slide #268

Open evgenygil opened 6 years ago

evgenygil commented 6 years ago

Generating block with div's inside slider, per 4 divs on one slide, when it's many, there are some problem with last slide, it's cutted (transform: translate3d having wrong value). When I get 1,2,3 slide everything OK, like this image

But when i go to last slide (4) i see image

It's not going to the end, and I don't see last image fully

Tiny-slider version: 2.8.6 Browser name && version: in all browsers (chrome/firefox..) OS name && version: Ubuntu 16, Windows 10

Here is config

let slider = tns({
                mode: 'carousel',
                container: sOffers,
                slideBy: 'page',
                fixedWidth: 160,
                gutter: 0,
                edgePadding: 0,
                controlsText: ['', ''],
                autoHeight: true,
                loop: false,
                items: (countOffers < 4) ? countOffers : 4, // default number of items
                responsive: false,
                controlsContainer: floorWrapper.querySelector('.s-tns-controls'),
                nav: false,
                lazyload: true
            });
DMCK96 commented 6 years ago

Happening to me too. The last item remains at aria-hidden="false" which may possibly be related?

    let slider = tns({
        container: sliderContainer[0],
        "autoWidth": true,
        "items": 3,
        "slideBy": 2,
        "mouseDrag": true,
        "controlsContainer": document.getElementsByClassName('events-timeline__events__controls-container')[0],
        "loop": false,
        "nav": false,
        "swipeAngle": false,
        "arrowKeys": true,
        "speed": 400
    });
ThaoD5 commented 6 years ago

Up, this is really annoying us on multiple productions :/

v-lukoyanov commented 6 years ago

I have same problem. Have you any decision?

v-lukoyanov commented 6 years ago

I have found out that this problem begins from version 2.8.0 and later

ganlanyuan commented 6 years ago

@Gil707 I couldn't reproduce this issue with your config. Do you think you can make a live demo on codepen? Same to @DMCK96 Thanks

zipper commented 6 years ago

This is the same issue as I reported recently #310.

ruborg commented 6 years ago

Same issue here, last item not visible, transform3d seems to have wrong value.

ruborg commented 6 years ago

Workaround that I'm using right now is to add an invisible dummy item at the end that's wide enough so that the real last item is in viewport

tangleMesh commented 6 years ago

Got the same bug with fixedWidth, gutter and slideBy=page.

ganlanyuan commented 5 years ago

Again, if you want me to check this quickly, please make a demo.

stffndtz commented 5 years ago

I was running into the same issue using fixedWidth elements - turns out that using min-width on the slider elements (which I used for non-js displaying of the slider) was messing with the calculations.

Removing it and conditionally applying the styling helped. Hopefully someone will find this useful!