if I have in one section 3 sliders on top of each other with position absolute and each slider has different height how can I prevent the next section from going inside the one slider who has longer content?
const next = document.querySelector('button')
let wr = document.querySelectorAll('.wrapper')
let count = 2
next.addEventListener('click' ,()=>{
document.querySelector('.wrapper.show').classList.remove('show')
document.querySelector(`.wrapper-${count}`).classList.add('show')
count++
if(count>3){
count =1
}
})
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.wrapper-container {
position: relative;
height: 150px;
}
.wrapper {
position: absolute;
opacity: 0;
}
.show {
opacity: 1;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<section>
<button>next</button>
<div class="wrapper-container">
<div class="wrapper wrapper-1 show">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
</div>
<div class="wrapper wrapper-2">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
</div>
<div class="wrapper wrapper-3">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque.
</p>
</div>
</div>
</section>
<section>
<h2>title one </h2>
</section>
<script src="./script.js"></script>
</body>
</html>
and if I make wrapper-container with more height it would be more space between one slider and next section