сделал how js для пк
This commit is contained in:
@@ -490,6 +490,12 @@
|
||||
|
||||
width: 100%;
|
||||
}
|
||||
.how-content__item-block{
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
|
||||
transition: height .3s;
|
||||
}
|
||||
.how-content__item{
|
||||
width: 100%;
|
||||
|
||||
@@ -498,11 +504,6 @@
|
||||
background-color: var(--background-grey);
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
display: none;
|
||||
}
|
||||
.how-content__item.active{
|
||||
display: block;
|
||||
}
|
||||
.how-content__item .text-2{
|
||||
margin-top: 16px;
|
||||
|
||||
@@ -43,3 +43,32 @@ const reviewsSwiper = new Swiper('.reviews-swiper', {
|
||||
})
|
||||
|
||||
// gymSwiper.destroy();
|
||||
|
||||
// how
|
||||
|
||||
function howPc() {
|
||||
let itemButtons = document.querySelectorAll('.how-control__item'),
|
||||
itemBlocks = document.querySelectorAll('.how-content__item-block');
|
||||
|
||||
itemButtons.forEach((button, index) => {
|
||||
let block = itemBlocks[index];
|
||||
|
||||
button.onclick = function () {
|
||||
let activeContent = document.querySelector('.how__content').querySelector('.active'),
|
||||
activeButton = document.querySelector('.how__control').querySelector('.active');
|
||||
|
||||
activeContent.style.height = '0px';
|
||||
activeContent.classList.remove('active');
|
||||
activeButton.classList.remove('active');
|
||||
|
||||
setTimeout(() => {
|
||||
let newHeight = block.querySelector('.how-content__item').offsetHeight + 'px';
|
||||
block.style.height = newHeight;
|
||||
block.classList.add('active');
|
||||
button.classList.add('active');
|
||||
}, 300);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
howPc();
|
||||
Reference in New Issue
Block a user