Search code examples
javascriptcssvue.jsflickityvue-flickity

Flickity not hiding on desktop


I want the flickity slider to hide on desktop and larger devices. I think I'm following the instructions in the documentation, they seem pretty straightforward, however, It's not working.

Div looks something like this:

<div class="w-full flex pl-4 pb-16 overflow-x-auto lg:justify-center">
    <flickity class="main-carousel mx-20 mt-5 sm:my-10 w-10/12" ref="flickity" :options="{ lazyLoad: 3, watchCss: true, cellAlign: 'left', wrapAround: true, pageDots: true, pauseAutoPlayOnHover: true, arrowShape: { x0: 0, x1: 75, y1: 50, x2: 90, y2: 50, x3: 15 } }">
        <PlanesCard v-for="(plan, index) in getTiers" :key="index" :value="plan.value" :name="plan.name" />
    </flickity>
</div>

Styling like this:

    .main-carousel:after {
        content: 'flickity';
        display: none;
    }

    @media (min-width: 1024px) {
        .main-carousel:after {
            content: '';
        }
    }

which is the component that gets "flicked", looks something like this, even though I think it's not important:

<article :class="planText()" class="py-8 flex-shrink-0">
    <h2>
        <span>{{ value }}</span>
    </h2>
    <ul class="text-left pl-6 pr-4">
        <PlanList v-for="pl in getFeatures" :key="pl.title" :plan="name" />
    </ul>
</article>

Also, I don't know if this is important, but when I inspect the element on Chrome, I have this:

enter image description here

Thanks in advance!


Solution

  • I think you misspelled a property. I reproduced your problem and fixed it by changing the property "watchCss" to "watchCSS".