сделал how js для пк
This commit is contained in:
@@ -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