I've a slider and the first slide has class first-slide. When i'm in a slider, it adds the class active automatically. I want that if this slide has the class active and first-slide also, the swiper will have a height of 100vh.
When I go to the next slide, the slider won't have the class first-slide so I want the swiper height to be auto.
I'm trying to do it like this but it doesn't apply the height: auto when I go to the second slide... it doesn't work:
if ($('.slider').hasClass('first-slide', 'active')) {
$('.swiper').css('height', '100vh')
} else {
$('.swiper').css('height', 'auto')
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="swiper">
<div class=" swiper-wrapper ">
<div class="slider ">
<!-- I only put 1 slider but you understand is more than one -->
</div>
</div>
</div>