сделал адаптивность для projects
This commit is contained in:
@@ -364,6 +364,8 @@
|
||||
|
||||
/* projects */
|
||||
.projects{
|
||||
}
|
||||
.projects .swiper-wrapper{
|
||||
margin: 37px -20px -20px -20px;
|
||||
|
||||
display: flex;
|
||||
@@ -372,7 +374,7 @@
|
||||
.projects__item{
|
||||
margin: 20px;
|
||||
|
||||
width: calc(50% - 40px);
|
||||
width: calc(50% - 40px) !important;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -425,6 +427,9 @@
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.projects__counter{
|
||||
display: none;
|
||||
}
|
||||
/* projects */
|
||||
|
||||
/* how */
|
||||
|
||||
@@ -329,4 +329,79 @@ main{
|
||||
margin-left: 8px;
|
||||
}
|
||||
}
|
||||
/* gym */
|
||||
/* gym */
|
||||
|
||||
/* projects */
|
||||
@media only screen and (max-width: 992px) {
|
||||
.projects{
|
||||
overflow: hidden;
|
||||
}
|
||||
.projects .swiper-wrapper{
|
||||
margin: 40px 0 0 0;
|
||||
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.projects__item{
|
||||
margin: 0;
|
||||
|
||||
width: 100% !important;
|
||||
}
|
||||
.projects-item__img{
|
||||
height: 200px;
|
||||
}
|
||||
.projects-item__content{
|
||||
padding: 16px;
|
||||
|
||||
min-height: auto;
|
||||
}
|
||||
.projects-item__tag{
|
||||
margin-left: 24px;
|
||||
}
|
||||
.projects-item__text{
|
||||
margin-top: 16px;
|
||||
}
|
||||
.projects-item__text .text-1{
|
||||
font-size: 20px;
|
||||
}
|
||||
.projects__next{
|
||||
display: none;
|
||||
}
|
||||
.projects__counter{
|
||||
margin-top: 40px;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
font-weight: 400;
|
||||
font-size: 18px;
|
||||
color: var(--text-white);
|
||||
}
|
||||
|
||||
.projects .swiper-button-next::after, .projects .swiper-button-prev::after{
|
||||
position: static;
|
||||
|
||||
font-size: 0;
|
||||
}
|
||||
.projects .swiper-button-next, .projects .swiper-button-prev{
|
||||
position: static;
|
||||
|
||||
margin-top: 0;
|
||||
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
.projects .swiper-button-next{
|
||||
margin-left: 40px;
|
||||
|
||||
background-image: url(/assets/img/icon/slider-righ.svg);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.projects .swiper-button-prev{
|
||||
margin-right: 40px;
|
||||
|
||||
background-image: url(/assets/img/icon/slider-left.svg);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
}
|
||||
/* projects */
|
||||
@@ -42,65 +42,99 @@ const reviewsSwiper = new Swiper('.reviews-swiper', {
|
||||
}
|
||||
})
|
||||
|
||||
// gymSwiper.destroy();
|
||||
|
||||
const projectsSwiper = new Swiper('.projects-swiper', {
|
||||
direction: 'horizontal',
|
||||
breakpoints: {
|
||||
320:{
|
||||
slidesPerView: 1,
|
||||
spaceBetween: 24,
|
||||
},
|
||||
996: {
|
||||
slidesPerView: 1
|
||||
},
|
||||
},
|
||||
// Navigation arrows
|
||||
navigation: {
|
||||
nextEl: '.swiper-button-next',
|
||||
prevEl: '.swiper-button-prev',
|
||||
},
|
||||
runCallbacksOnInit: true,
|
||||
// === new change
|
||||
on: {
|
||||
slideChange: function(){
|
||||
let offer = document.querySelector('#numberProjects');
|
||||
offer.innerHTML = (this.activeIndex + 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// how
|
||||
let itemButtons = document.querySelectorAll('.how-control__item');
|
||||
itemButtons.forEach((button) => {
|
||||
let num = button.dataset.num;
|
||||
|
||||
button.onclick = function name(params, index) {
|
||||
|
||||
let activeContent = document.querySelector('.how__content').querySelector('.active'),
|
||||
activeButton = document.querySelector('.how__control').querySelector('.active');
|
||||
|
||||
if (activeContent.dataset.num == button.dataset.num) return;
|
||||
|
||||
activeContent.style.height = '0px';
|
||||
activeContent.classList.remove('active');
|
||||
activeButton.classList.remove('active');
|
||||
|
||||
let newActive = document.querySelector(`.how-content__item-block[data-num='${num}']`),
|
||||
newButton = document.querySelector(`.how-control__item[data-num='${num}']`);
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
let newHeight = newActive.querySelector('.how-content__item').offsetHeight + 'px';
|
||||
newActive.style.height = newHeight;
|
||||
newActive.classList.add('active');
|
||||
newButton.classList.add('active');
|
||||
}, 300);
|
||||
}
|
||||
})
|
||||
function howPc() {
|
||||
let itemButtons = document.querySelectorAll('.how-control__item');
|
||||
if (document.querySelector('.how__content').querySelector('.how-content__item-block')) {
|
||||
return;
|
||||
}
|
||||
|
||||
itemButtons.forEach((button) => {
|
||||
let num = button.dataset.num;
|
||||
let blocks = document.querySelectorAll('.how-content__item-block'),
|
||||
content = document.querySelector('.how__content');
|
||||
|
||||
button.onclick = function name(params, index) {
|
||||
blocks.forEach(block => {
|
||||
content.appendChild(block)
|
||||
});
|
||||
}
|
||||
function howPhone() {
|
||||
if (!document.querySelector('.how__content').querySelector('.how-content__item-block')) {
|
||||
return;
|
||||
}
|
||||
|
||||
let buttons = document.querySelectorAll('.how-control__item');
|
||||
|
||||
let activeContent = document.querySelector('.how__content').querySelector('.active'),
|
||||
activeButton = document.querySelector('.how__control').querySelector('.active');
|
||||
|
||||
if (activeContent.dataset.num == button.dataset.num) return;
|
||||
buttons.forEach(button => {
|
||||
let num = button.dataset.num,
|
||||
block = document.querySelector(`.how-content__item-block[data-num='${num}']`);
|
||||
|
||||
activeContent.style.height = '0px';
|
||||
activeContent.classList.remove('active');
|
||||
activeButton.classList.remove('active');
|
||||
|
||||
let newActive = document.querySelector(`.how-content__item-block[data-num='${num}']`),
|
||||
newButton = document.querySelector(`.how-control__item[data-num='${num}']`);
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
let newHeight = newActive.querySelector('.how-content__item').offsetHeight + 'px';
|
||||
newActive.style.height = newHeight;
|
||||
newActive.classList.add('active');
|
||||
newButton.classList.add('active');
|
||||
}, 300);
|
||||
}
|
||||
})
|
||||
button.after(block);
|
||||
});
|
||||
}
|
||||
|
||||
howPc();
|
||||
|
||||
|
||||
// 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);
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// resize
|
||||
window.addEventListener('resize', () => {
|
||||
let screenWidth = window.screen.width;
|
||||
|
||||
if (screenWidth <= 992) {
|
||||
howPhone();
|
||||
}else{
|
||||
howPc();
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user