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

The size of the thumbnails varies from one another. #83

Open
2 tasks done
saimow opened this issue Feb 24, 2023 · 0 comments
Open
2 tasks done

The size of the thumbnails varies from one another. #83

saimow opened this issue Feb 24, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@saimow
Copy link

saimow commented Feb 24, 2023

Checks

Version

0.6.12

Description

I created a thumbnail Carousel using this package and everything seems to work fine.
splider1

But since I am passing images with different sizes to the component, I noticed that the thumbnails size also varies from one another as you see on the image below.
slider2

This is how I'm using the component:

<template>
    <div class="slider-container">
        <div class="wrapper">        
            <Splide
                aria-labelledby="thumbnail-example-heading"
                :options="mainOptions"
                ref="main"
            >
                <SplideSlide v-for="slide in slides">
                    <img :src="'/storage/products/media/'+slide.name">
                </SplideSlide>
            </Splide>
        
            <Splide
                aria-label="The carousel with thumbnails. Selecting a thumbnail will change the main carousel"
                :options="thumbsOptions"
                ref="thumbs"
            >
                <SplideSlide v-for="slide in slides">
                    <img :src="'/storage/products/media/'+slide.name">
                </SplideSlide>
            </Splide>
        </div>
    </div>
</template>
  
<script>
    import { Splide, SplideSlide } from '@splidejs/vue-splide';
    import '@splidejs/vue-splide/css';

    export default {
        props:{
            slides: {
                type: Array,
                default: []
            }
        },
        mounted(){
            this.$refs.main.sync( this.$refs.thumbs.splide );
        },
        data(){
            return{
                mainOptions: {
                    type: 'loop',
                    perPage: 1,
                    perMove: 1,
                    gap: '1rem',
                    pagination: false,
                },
                thumbsOptions: {
                    type: 'slide',
                    rewind: true,
                    gap: 5,
                    pagination: false,
                    fixedWidth: 110,
                    fixedHeight: 70,
                    cover: true,
                    focus: 'center',
                    isNavigation: true,
                    updateOnMove: true,
                }
            }
        },
        components: {
            Splide,
            SplideSlide
        },
    }
</script>

<style scoped>
.slider-container{
    width: 700px;
}
.splide__slide img {
    width: 100%;
    height: 500px;
    object-fit: cover;
    
}
.splide--slide {
    margin-top: 0.5rem;
}
</style>

Reproduction Link

No response

Steps to Reproduce

  1. setup the component as I mentioned in the issue description.
  2. pass images with different sizes to :slides prop.

Expected Behaviour

The size of the thumbnails varies from one another.

@saimow saimow added the bug Something isn't working label Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant