I have a problem using a vertical slider , the Swiper Slider I'm using the < in> MouseWheel control .
My problem is this, since it's a vertical slider , I need to set a size for height
, so I can not make it responsive.
Example:
Below is the css file where I define the size of the container
that will contain the elements of slider
.
.swiper-container { /*esta classe comporta os slides.*/
width: 100%;
height: 900px;
margin-left: auto;
margin-right: auto;
}
.swiper-slide { /nesta classe encontram-se os compontes do swiper.container.*/
text-align: center;
font-size: 18px;
/* Center slide text vertically */
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
}
As you can see, I set the size of height
to 900px
, of course, on smaller screens it will continue with 900px
, I need it to fit screen size, this can solve with media-queries
but I have one more problem, see the script that initializes the slider :
The option slidesPerView
, defines how many slides will appear on the screen at a time, if I decrease the height
, 4 slides will continue to appear: /
$(document).ready(function () {
//initialize swiper when document ready
var mySwiper = new Swiper ('.swiper-container', {
// Optional parameters
pagination: '.swiper-pagination',
direction: 'vertical',
slidesPerView: 4,
paginationClickable: true,
spaceBetween: 30,
mousewheelControl: true
})
});
The html I put in the pen because otherwise the post would be too long.
Any ideas how to solve it? I'm also accepting indications of some vertical slider better.
I'm using materialize as a css framework.