Vertical mode slidesToShow not working
- Langage dominant
- JavaScript
- Étoiles
- 11.9k
- Forks
- 2.1k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
When using the vertical mode option the slidesToShow option is ignored. I had to fix it with a fixed height on the slides children element. But I'd rather have it dynamic based on the height of the parent, where slick should calculate the height of the slides based on the parent..
Slider component
```
export const FeaturePartners = props => {
const { title, text, button, partners = partnersList } = props;
const slides = partners.map((partner, index) => {
return ;
});
return (
{title &&
{title}
} {text &&
text.map((p, i) => {
return text.length !== i + 1 ? (
{p}
) : (
{p}
);
})}
{button && (
{button.text}
)}
{slides}
);
};
```
Slide component
```
export const Slide = props => {
const { filename, alt = '' } = props;
return (
);
};
```
styles.module.scss:
```
.feature-partners {
background-color: var(--clr-black);
color: var(--clr-white);
&__container {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: space-between;
}
&__title {
font-size: 7.2rem;
line-height: 8.5rem;
letter-spacing: 0.144rem;
margin: 0 0 2.5rem 0;
}
&__column {
width: 45%;
}
&__info {
padding: 10rem 0;
}
&__last-paragraph {
margin: 0 0 5rem 0;
}
&__slider-container {
position: relative;
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: block;
z-index: 2;
background: rgb(26, 26, 26);
background: -moz-linear-gradient(
0deg,
rgba(26, 26, 26, 1) 0%,
rgba(26, 26, 26, 1) 10%,
rgba(26, 26, 26, 0) 15%,
rgba(26, 26, 26, 0) 85%,
rgba(26, 26, 26, 1) 90%,
rgba(26, 26, 26, 1) 100%
);
background: -webkit-linear-gradient(
0deg,
rgba(26, 26, 26, 1) 0%,
rgba(26, 26, 26, 1) 10%,
rgba(26, 26, 26, 0) 15%,
rgba(26, 26, 26, 0) 85%,
rgba(26, 26, 26, 1) 90%,
rgba(26, 26, 26, 1) 100%
);
background: linear-gradient(
0deg,
rgba(26, 26, 26, 1) 0%,
rgba(26, 26, 26, 1) 10%,
rgba(26, 26, 26, 0) 15%,
rgba(26, 26, 26, 0) 85%,
rgba(26, 26, 26, 1) 90%,
rgba(26, 26, 26, 1) 100%
);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#1a1a1a",endColorstr="#1a1a1a",GradientType=1);
}
}
&__slide-wrapper {
height: 33vh;
display: flex;
align-items: center;
justify-content: center;
}
&__slide-img {
width: 100%;
height: 100%;
object-fit: contain;
object-position: center;
max-height: 20rem;
max-width: 25rem;
}
}
```
settings.js:
```
const settings = {
arrows: false,
dots: false,
infinite: true,
slidesToShow: 3,
slidesToScroll: 1,
vertical: true,
verticalSwiping: false,
swipe: false,
autoplay: true,
autoplaySpeed: 3000,
};
export default settings;
```
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.